Find and Replace

M

Maria

I'm so excited about my newly discovered find and replace
knowledge, most of which I've gleaned from the wonderful
MVPS site! Today I was given the task of FINDING about
100 instances of two or more numbers followed by an "R"
followed by two or more numbers. I was to REPLACE with
the same numbers and a period after the R. and the whole
set of numbers in parentheses (for example, "39R2567"
should read "(39R.2567)".

In the Find box I placed ([0-9]{2,})R([0-9]{2,})and
Replaced with (\1R.\2). Although this sounds elementary
to you, I actually felt like the smartest gal on earth
when it worked and I want to sincerely thank you!

BUT in a few of the instances there were spaces after the
R and I did that find and replace separately.

Could I have done both of these with one search (i.e.,
find the R with or without spaces after)? If so, how?

THANK YOU, THANK YOU, THANK YOU!
 
G

Greg Maxey

Maria,

If the only difference was R or R space in the number collection, you could
have used
(*) in place of R in your find string.

--
Greg Maxey
A peer in "peer to peer" support
Rockledge, FL
E-mail for additional help, within reason, if you like. I may not
always solve your problem, but no charge if I do. To e-mail, first edit
out the "w...spam" in the displayed address.
 
M

Maria

Thanks a million, Greg! Would you check out my question
in "Find and Replace Continued" and see if you can help?
Thanks for all you do for us, Greg.
-----Original Message-----
Maria,

If the only difference was R or R space in the number collection, you could
have used
(*) in place of R in your find string.

--
Greg Maxey
A peer in "peer to peer" support
Rockledge, FL
E-mail for additional help, within reason, if you like. I may not
always solve your problem, but no charge if I do. To e- mail, first edit
out the "w...spam" in the displayed address.
I'm so excited about my newly discovered find and replace
knowledge, most of which I've gleaned from the wonderful
MVPS site! Today I was given the task of FINDING about
100 instances of two or more numbers followed by an "R"
followed by two or more numbers. I was to REPLACE with
the same numbers and a period after the R. and the whole
set of numbers in parentheses (for example, "39R2567"
should read "(39R.2567)".

In the Find box I placed ([0-9]{2,})R([0-9]{2,})and
Replaced with (\1R.\2). Although this sounds elementary
to you, I actually felt like the smartest gal on earth
when it worked and I want to sincerely thank you!

BUT in a few of the instances there were spaces after the
R and I did that find and replace separately.

Could I have done both of these with one search (i.e.,
find the R with or without spaces after)? If so, how?

THANK YOU, THANK YOU, THANK YOU!


.
 
K

Klaus Linke

[...] I was to REPLACE with the same numbers and
a period after the R. and the whole set of numbers in
parentheses (for example, "39R2567"
should read "(39R.2567)".

In the Find box I placed ([0-9]{2,})R([0-9]{2,})and
Replaced with (\1R.\2). [...]
BUT in a few of the instances there were spaces after
the R and I did that find and replace separately.


Greg Maxey said:
Maria,

If the only difference was R or R space in the number collection,
you could have used (*) in place of R in your find string.


The * wildcard may well be too risky, since it might match a whole lot of
text.

Unfortunately, Word can neither search for "zero or more occurrances" --
such as ( ){0,} -- nor has it a way to search for "a" OR "b" which many
other implementations of wildcards offer.
I can only suggest to e-mail to (e-mail address removed) each time you miss
these features (specifying "Word: wildcard searches" or something like that
in the header).

Find what: ([0-9]{2,})[R ]@([0-9]{2,})
might do the trick as a work-around.
It would match two numbers, any combination of "R" and " ", and two more
numbers.
Thus it still may still match text you wouldn't want to match, but is a lot
safer than the "*" wildcard.

Greetings,
Klaus
 

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