How to find and replace a number range in MS Word

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I'm trying to do a Find and Replace function in MS Word to find all
numbers ranging between 0 and 999999 and to effectively delete these. Does
anyone know how to construct this in the Find and Replace function?

Thanks in advance. Chaps
 
Wildcard search for

[0-9]

replace with nothing

will delete all numbers from the document. If you want to remove the space
also, you would need

[0-9]{1,6}[ ]

replace with nothing.

The square brackets around the space are unnecessary, yoiu can leave them or
not as you wish.

See http://www.gmayor.com/replace_using_wildcards.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

See http://www.gmayor.com/replace_using_wildcards.htm
 
Hi Graham,

Thanks for your reply. However I am not looking to remove all numbers in the
document, I am only seeking to remove the range 0-999999. What I want to keep
in my document is all numbers that contain 7 digits or more. Any numbers that
contain 6 digits or less I wish to remove.

Example: I wish to remove all numbers such as 1, 14, 399, 6666, 12345,
999999 but if they are 1234567 or 9876543210 then I wish to keep them.

Thanks,

chappy
Graham Mayor said:
Wildcard search for

[0-9]

replace with nothing

will delete all numbers from the document. If you want to remove the space
also, you would need

[0-9]{1,6}[ ]

replace with nothing.

The square brackets around the space are unnecessary, yoiu can leave them or
not as you wish.

See http://www.gmayor.com/replace_using_wildcards.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

See http://www.gmayor.com/replace_using_wildcards.htm

Hi, I'm trying to do a Find and Replace function in MS Word to find
all numbers ranging between 0 and 999999 and to effectively delete
these. Does anyone know how to construct this in the Find and Replace
function?

Thanks in advance. Chaps
 
Try this, with Use Wildcards enabled.

Find what:[!0-9][0-9]{1,6}[!0-9]

Replace with:<leave blank>

If your document begins with a number qualified for deletion, then that
number will be missed by the search. All other numbers containing 1 to 6
digits will be deleted.

[!0-9]= Not a number

[0-9]{1,6}=Numbers with 1 to 6 digits

[!0-9]=Not a number

So, basically, it searches for 1 to 6 digit numbers that are brackets by
non-numbers.

--
Herb Tyson MS MVP
Please respond in the newsgroups so everyone can follow along.
Chappy said:
Hi Graham,

Thanks for your reply. However I am not looking to remove all numbers in
the
document, I am only seeking to remove the range 0-999999. What I want to
keep
in my document is all numbers that contain 7 digits or more. Any numbers
that
contain 6 digits or less I wish to remove.

Example: I wish to remove all numbers such as 1, 14, 399, 6666, 12345,
999999 but if they are 1234567 or 9876543210 then I wish to keep them.

Thanks,

chappy
Graham Mayor said:
Wildcard search for

[0-9]

replace with nothing

will delete all numbers from the document. If you want to remove the
space
also, you would need

[0-9]{1,6}[ ]

replace with nothing.

The square brackets around the space are unnecessary, yoiu can leave them
or
not as you wish.

See http://www.gmayor.com/replace_using_wildcards.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

See http://www.gmayor.com/replace_using_wildcards.htm

Hi, I'm trying to do a Find and Replace function in MS Word to find
all numbers ranging between 0 and 999999 and to effectively delete
these. Does anyone know how to construct this in the Find and Replace
function?

Thanks in advance. Chaps
 
Thanks Herb, it works a treat!

Herb Tyson said:
Try this, with Use Wildcards enabled.

Find what:[!0-9][0-9]{1,6}[!0-9]

Replace with:<leave blank>

If your document begins with a number qualified for deletion, then that
number will be missed by the search. All other numbers containing 1 to 6
digits will be deleted.

[!0-9]= Not a number

[0-9]{1,6}=Numbers with 1 to 6 digits

[!0-9]=Not a number

So, basically, it searches for 1 to 6 digit numbers that are brackets by
non-numbers.

--
Herb Tyson MS MVP
Please respond in the newsgroups so everyone can follow along.
Chappy said:
Hi Graham,

Thanks for your reply. However I am not looking to remove all numbers in
the
document, I am only seeking to remove the range 0-999999. What I want to
keep
in my document is all numbers that contain 7 digits or more. Any numbers
that
contain 6 digits or less I wish to remove.

Example: I wish to remove all numbers such as 1, 14, 399, 6666, 12345,
999999 but if they are 1234567 or 9876543210 then I wish to keep them.

Thanks,

chappy
Graham Mayor said:
Wildcard search for

[0-9]

replace with nothing

will delete all numbers from the document. If you want to remove the
space
also, you would need

[0-9]{1,6}[ ]

replace with nothing.

The square brackets around the space are unnecessary, yoiu can leave them
or
not as you wish.

See http://www.gmayor.com/replace_using_wildcards.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

See http://www.gmayor.com/replace_using_wildcards.htm


Chappy wrote:
Hi, I'm trying to do a Find and Replace function in MS Word to find
all numbers ranging between 0 and 999999 and to effectively delete
these. Does anyone know how to construct this in the Find and Replace
function?

Thanks in advance. Chaps
 
Back
Top