Wildcard search redux

E

ekeby

God am I glad I found this forum--I hope someone can help. I've
searched past posts and not sure this has been answered--maybe I don't
understand the subject well enough.
I'm prepping a Word document to import into Quark. The document is a
directory, and the client wants changes to the formating. For example,
all of the phone numbers are written

608.555.1212

that is, with periods between area code and exchange and number. The
client wants them to read

Tel: (608) 555-1212

Each item to be changed is on a line by itself. Is it possible to make
this kind of a change with a global find and replace in Word?

Thanks!
Nicol K
EKEBY

Reply



From: Michel Bintener - view profile
Date: Thurs, Apr 13 2006 5:43 pm
Not yet rated

show options

Hi Nicol,
yes, that can be done, and here's how. First of all, make sure that
you've
got the wildcard search enabled. Then, in the Find field, enter the
following line:

([0-9]{3}).([0-9]{3}).([0-9]{4})

Translated, this means "find a string of three numbers, then a dot,
then
another string of three numbers, then another dot, and then finally a
string
of four numbers." Now, enter this line into the Replace field:

Tel: (\1) \2-\3

This means "add Tel: , then put brackets around the first string, then
a
space, then the second string and a hyphen followed by the first
string." It
should work, I've just tested this.

--
Michel Bintener
Microsoft MVP
Office:Mac (Word & Entourage)

On 13.04.06 23:33, in article
(e-mail address removed), "ekeby"

- Show quoted text -


















Reply Rate this post:



From: Michel Bintener - view profile
Date: Thurs, Apr 13 2006 5:48 pm
Not yet rated

show options

This means "add Tel: , then put brackets around the first string, then a
space, then the second string and a hyphen followed by the first string."

Sorry, that should read "a hyphen followed by the *third* string."
--
Michel Bintener
Microsoft MVP
Office:Mac (Word & Entourage)

Reply Rate this post:



From: ekeby - view profile
Date: Thurs, Apr 13 2006 6:24 pm
Not yet rated

show options

many many thanks--
next question: does that work with text as well? Replacing 0-9 with
a-z? This same directory has email addresses that the client wants to
precede with
E-mail:
The only constant I see is that they all have an @ symbol.

I believe the other changes I know how to do, and that I can adapt
your command line to change hyphens between years to en dashes:

([0-9]{4})-([0-9]{4})

and then repeat with en dash replacing hyphen--would that be correct?

Reply



From: ekeby - view profile
Date: Thurs, Apr 13 2006 6:40 pm
Not yet rated

show options

Actually, I realize that the email address always follows the fax
number, so that once I made the necessary change to the fax number, I
could search for that along with the return that follows it, repeat it
all but add the word E-mail: after the return. However, I don't know
that every single entry has a fax number.
Another situation in this file: sometimes dates are included without
word spaces, as in September4,1946. I think I could first search and
replace
([0-9]{2}),([0-9]{4})
and then repeat it to cover 1-digit dates . . . .??

Reply



From: Michel Bintener - view profile
Date: Fri, Apr 14 2006 3:15 am
Not yet rated

show options

Hello again,
I had to some experimenting before I got this right, I normally don't
use
wildcard search in Word and it's not *that* easy, to be honest.

To insert the "E-mail: " tag, do the following Find and Replace (again,
with
wildcards enabled):

Find: ([A-z]{1,})\@
"a string with one or more letters, whether capitalised or not,
followed by
the @-sign" ("\@", as "@" all by itself has a different meaning in
wildcard
search)
Replace: E-mail: \1@
"E-mail: , plus the first string followed by an @-sign" (note that in
the
Replace field, you can use the @ without the backslash)

This works with email addresses that look like yours, no punctuation
between
names. If you happen to have some of these, this wildcard search won't
work
as expected, so post back if that's the case, and I'll look into it.

For the dates:

Find: ([0-9]{1,}),([0-9]{4})
"a string with a sequence of at least one number, followed by a comma,
then
another string of four numbers"
Replace: [SPACE]\1, \2
"space, first string, comma, space, second string" (note that you'll
have to
replace the initial [SPACE] with a normal space, I just put it there to
make
it obvious that you'll have to insert a space before the first string
in
order to separate the days from the months)

I hope this was helpful. If you want to find out more about wildcards,
you
might want to read this really helpful article on the Microsoft Word
MVP
website: http://word.mvps.org/faqs/general/UsingWildcards.htm

This part of the website does not display properly in Safari, so you'd
better use a different browser to navigate to it; alternatively, hit
refresh
a couple of times in Safari, and you *should* be able to see it.

--
Michel Bintener
Microsoft MVP
Office:Mac (Word & Entourage)

On 14.04.06 0:40, in article
(e-mail address removed), "ekeby"

- Show quoted text -













Reply Rate this post:



From: ekeby - view profile
Date: Fri, Apr 21 2006 10:46 am
Not yet rated

show options

Hi Michael . . . I'm finally in production on this job . . . and I
find that your suggestion (see below) is not working for me. I cannot
achieve a "find"
with:
([0-9]{3}).([0-9]{3}).([0-9]{4})

I can only achieve a find with the first expression (or first plus
second without the following period), as in

([0-9]{3}). or ([0-9]{3}).([0-9]{3})

SO--I tried a replace using the first expression, using Tel: (\)

and what I got (for phone number 256.372.5478 was

25(6) 372.5478

that is, only the last digit of the area code got put in parentheses.
Am I doing something wrong?

Nicol K

SEE OLDER MESSAGE DATED APRIL 13 FOR COMPLETE TREE

Hi Nicol,
yes, that can be done, and here's how. First of all, make sure that
you've
got the wildcard search enabled. Then, in the Find field, enter the
following line:

([0-9]{3}).([0-9]{3}).([0-9]{4})

Translated, this means "find a string of three numbers, then a dot,
then
another string of three numbers, then another dot, and then finally a
string
of four numbers." Now, enter this line into the Replace field:

Tel: (\1) \2-\3

This means "add Tel: , then put brackets around the first string, then
a
space, then the second string and a hyphen followed by the first
string." It
should work, I've just tested this.
 

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