Find and replace extensive numbers.

Copper Contributor

Hi,

I'm trying to find extensive numbers (for example "five, ten, eleven"), and replace them with their correspondent Arabic numbers (like "5, 10, 11"). Is there a way to do that using find and replace in Word? I can't seem to find the correct regex.

 

Thanks in advance.

Cindi.

2 Replies

Hi @cindix,

To find and replace extensive numbers in Word using Find and Replace, you can use the following regular expression:

 

\b(\w+)(-|\s)(and|to)\s(\w+)\b

 

 

This regex will match any word followed by a hyphen, space, or the words "and" or "to" followed by another word. It will also ignore any leading or trailing spaces.

To use this regex, follow these steps:

  1. Press Ctrl+H to open the Find and Replace dialog box.
  2. In the Find what box, type the regex \b(\w+)(-|\s)(and|to)\s(\w+)\b.
  3. In the Replace with box, type the Arabic number equivalent of the extensive number.
  4. Click Replace All to replace all instances of the extensive number in your document.

Here is an example of how to use the regex to replace the extensive number "five, ten, eleven" with the Arabic numbers "5, 10, 11":

 

Find what: \b(\w+)(-|\s)(and|to)\s(\w+)\b
Replace with: $1$2$3$4

 

 

This will replace the extensive number "five, ten, eleven" with the string "5, 10, 11".

Here are some links a a reference:

Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.


If the post was useful in other ways, please consider giving it Like.


Kindest regards,


Leon Pavesic

Nope. That gave me no results even though I have a text full of extensive numbers.
Maybe I should use a conversion VBA function?