Find and replace operation to be restricted to just 6 digit numbers

A

andreas

Dear Experts:

I would like the following find and replacement string to work only on
6 digit numbers not on 8 or 10 digit numbers as well? How can I
restrict the find string to numbers with just 6 digits?

Find: ([0-9][0-9]-[0-9][0-9]-[0-9][0-9])
Replace \1-04

Example: 82-04-07 results in 82-04-07-04

The trouble is that this find and replace operation works on numbers
such as 82-04-07-04 (8 digit numbers) as well.

How can I restrict the find string to just 6 digit numbers?

Help is much appreciated.

Thank you very much in advance.

Regards, Andreas
 
D

Doug Robbins - Word MVP

If the numbers that you want modified have a space before and after them,
add a space before the ( and after the ) in the find string.

If they are in paragraphs by themselves, for the find, use

^13([0-9][0-9]-[0-9][0-9]-[0-9][0-9])^13

and for the replace, use

^p\1-04^p

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
A

andreas

Search for [!0-9-]([0-9]{2}-[0-9]{2}-[0-9]{2})[!0-9-]
Seehttp://www.gmayor.com/replace_using_wildcards.htm

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

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>




Dear Experts:
I would like the following find and replacement string to work only on
6 digit numbers not on 8 or 10 digit numbers as well? How can I
restrict the find string to numbers with just 6 digits?
Find: ([0-9][0-9]-[0-9][0-9]-[0-9][0-9])
Replace \1-04
Example: 82-04-07 results in 82-04-07-04
The trouble is that this find and replace operation works on numbers
such as 82-04-07-04 (8 digit numbers) as well.
How can I restrict the find string to just 6 digit numbers?
Help is much appreciated.
Thank you very much in advance.
Regards, Andreas- Hide quoted text -

- Show quoted text -

Hi Graham,

sorry for the delay in answering. Exactly what I wanted. Thank you
very much for your professional help and the link to your superb
website tutorials.

Regards, Andreas
 
A

andreas

If the numbers that you want modified have a space before and after them,
add a space before the ( and after the ) in the find string.

If they are in paragraphs by themselves, for the find, use

^13([0-9][0-9]-[0-9][0-9]-[0-9][0-9])^13

and for the replace, use

^p\1-04^p

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com




Dear Experts:
I would like the following find and replacement string to work only on
6 digit numbers not on 8 or 10 digit numbers as well? How can I
restrict the find string to numbers with just 6 digits?
Find: ([0-9][0-9]-[0-9][0-9]-[0-9][0-9])
Replace \1-04
Example: 82-04-07 results in 82-04-07-04
The trouble is that this find and replace operation works on numbers
such as 82-04-07-04 (8 digit numbers) as well.
How can I restrict the find string to just 6 digit numbers?
Help is much appreciated.
Thank you very much in advance.
Regards, Andreas- Hide quoted text -

- Show quoted text -

Hi Doug,

thank you very much for your terrific support. It works as desired.

Regards, Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top