Find/Replace number using wildcards

jmt356
SilverLounger
Posts: 2389
Joined: 28 Mar 2010, 01:49

Find/Replace number using wildcards

Post by jmt356 »

When you know the number of digits of the number you are searching for, you can activate wildcards and search for
1) [0-9] or ([0-9]{1}): will find 1-digit numbers.
2) ([0-9]{2}): will find 2-digit numbers.
3) ([0-9]{3}): will find 3-digit numbers.
4) Etc.

When you don’t know the number of digits you are searching for:
1) [0-9]{1,2}: will find 1 or 2-digit numbers
2) [0-9]{1,3}: will find 1, 2 or 3-digit numbers
3) [0-9]{1,4}: will find 1, 2, 3 or 4-digit numbers
4) Etc.

What if you have no idea how many digits the number might have? Do you just put a ridiculously high number as the upper range (e.g., [0-9]{1,1000}) or is there an easier way to tell Word to "find any number"?
Regards,

JMT

User avatar
HansV
Administrator
Posts: 78484
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Find/Replace number using wildcards

Post by HansV »

You can omit the upper limit and use [0-9]{1,}
Alternatively, use [0-9]@
Best wishes,
Hans