search-replace: Formatting phone numbers imported from outlook

V

Von Stussi

Hi,

When I create a directory in word 2003 and import phone numbers from Oulook
they appear like that (I live in Japan)

+nn (nn) nnnnnnnn

I would like separate the country code/area code like that:

+nn-nn-

and then separate only the 4 first digits of the phone numbers with a "-"
like that:

nnnn-(followed by the second part of the number of 3 or 4 digits depending
of the area)

As a variante, when working with European phone number, I would like to
groups all the digit by 2 separated with a "-" like that:

nn-nn-nn-nn

What is the string I have to write in the "Find what" and "Replace with"
using wildcards for these 3 questions? Could you show me the strings
separately and if possible with a word of explanation. I would like to
understand the pattern.

When I try do do it by myslef, the country code/area code/end of the number
got all messed-up with with hyphens at the wrong place and incorrect groups
of digit.

Thanks
 
D

Doug Robbins - Word MVP

For Find what, use:

(+[0-9]{1,}) \(([0-9]{1,})\) ([0-9]{4})([0-9]{3,})

and for the Replace

\1-\2-\3-\4

For the explanation, see the article "Finding and replacing characters using
wildcards" at:

http://www.word.mvps.org/FAQs/General/UsingWildcards.htm


--
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
 
M

MT

Hi Doug,
That's just what I was looking for.
Thanks & thanks for the link.

Doug Robbins - Word MVP said:
For Find what, use:

(+[0-9]{1,}) \(([0-9]{1,})\) ([0-9]{4})([0-9]{3,})

and for the Replace

\1-\2-\3-\4

For the explanation, see the article "Finding and replacing characters using
wildcards" at:

http://www.word.mvps.org/FAQs/General/UsingWildcards.htm


--
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

Von Stussi said:
Hi,

When I create a directory in word 2003 and import phone numbers from
Oulook
they appear like that (I live in Japan)

+nn (nn) nnnnnnnn

I would like separate the country code/area code like that:

+nn-nn-

and then separate only the 4 first digits of the phone numbers with a "-"
like that:

nnnn-(followed by the second part of the number of 3 or 4 digits depending
of the area)

As a variante, when working with European phone number, I would like to
groups all the digit by 2 separated with a "-" like that:

nn-nn-nn-nn

What is the string I have to write in the "Find what" and "Replace with"
using wildcards for these 3 questions? Could you show me the strings
separately and if possible with a word of explanation. I would like to
understand the pattern.

When I try do do it by myslef, the country code/area code/end of the
number
got all messed-up with with hyphens at the wrong place and incorrect
groups
of digit.

Thanks
 

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