I am not very into coding right now. I got a Regex task solved in the Word Regex Search function.
Question to solve: What is the Regex to find all numbers between 1,000 and 9,999.
This is what I got so far: " [1-9]{1}\\,[0-9]{3} ". the expression \\b does not work in Word so I used just a blank space in front of the expression.
Is there a way to get it working in Word? In Notepad++ the Expression. \\b is actually working?
Regards Johannes
In MS Word, \\b
regex word boundaries do not work, the construct you need is <
and >
:
<[1-9],[0-9]{3}>
The <
is a leading word boundary and >
is a trailing word boundary.
To avoid matching the value before another comma (so as not to match 1,000
inside 1,000,000
) you may use
<[1-9],[0-9]{3}>[!,]
where [!,]
matches any chars but a comma. Note that <[1-9],[0-9]{3}>[!,]
won't match a 1-9,999 number at the end of the document (it will if there is any other char after the number).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.