phone numbers various formats

General discussions about Advanced Find and Replace
Post Reply
kleino
Posts: 12
Joined: Wed Nov 07, 2007 7:20 pm

phone numbers various formats

Post by kleino » Wed Nov 07, 2007 7:25 pm

I need to eliminate phone numbers from files
I dont always know the format of the number.
Possible formats could be

888-888-8888
(888)-888-8888
(888) 888-8888
888.888.8888
8888888888

I understand that I can do a batch replace with all 5 formats as above. But is there a way to provide the software just one format (e.g. 888-888-8888) and have it find all permutations and delete them?

Also, can you define "regular expression"

and also point to where this coding tutorial can be found so that I can make better use of the program. You provided this to another user:

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
(\(\d+\) \d+-)\d+ ext. (\d+)

Replace with:
$1$2

kleino
Posts: 12
Joined: Wed Nov 07, 2007 7:20 pm

Re: phone numbers various formats

Post by kleino » Wed Nov 07, 2007 7:51 pm

okay, I got it - I understand the regular expressions and the coding

so will the regular expression

.888.888.8888 find all permutations , such as

888-888-8888
(888)-888-8888
(888) 888-8888
888.888.8888
8888888888

Abacre
Site Admin
Posts: 1198
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Re: phone numbers various formats

Post by Abacre » Wed Nov 07, 2007 8:32 pm

The right regular expression describing strictly your case should be:

Search for:
\(*\d{3}[\)\-\. ]*\d{3}[\-\.]*\d{4}
Replace with:
should be empty text if you want to remove phone numbers.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

kleino
Posts: 12
Joined: Wed Nov 07, 2007 7:20 pm

Re: phone numbers various formats

Post by kleino » Thu Nov 08, 2007 7:40 pm

since I am unfamiliar with regular expressions, can you show me exactly waht to type in if I want to serach for the phone number 888-888-8888 but I dont know the format.
Thank you

Abacre
Site Admin
Posts: 1198
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Re: phone numbers various formats

Post by Abacre » Thu Nov 08, 2007 10:26 pm

\d means a digit,
\d{3} means exactly 3 digits.

For for 888-888-8888 you should use search for:
\d{3}-\d{3}-\d{4}
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

kleino
Posts: 12
Joined: Wed Nov 07, 2007 7:20 pm

Re: phone numbers various formats

Post by kleino » Fri Nov 09, 2007 3:16 am

I am sorry, that makes no sense to me. That would search for ANY 10 digit number. What EXACTLY do I type as the search string if I want to search for the phone number

9259359251
(which may exist in the files at 925-935-9251 or 925.935.9251 or (925) 935-9251 or (925)935-9251)

do I type:

9259359251\(*\d{3}[\)\-\. ]*\d{3}[\-\.]*\d{4}

or do I type as the search string

\(*\d{3}[\)\-\. ]*\d{3}[\-\.]*\d{4}9259359251

what EXACTLY do I type as the search string fto find the phone number 9259359251 in whatever format it may exist?

Thank you

Abacre
Site Admin
Posts: 1198
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Re: phone numbers various formats

Post by Abacre » Fri Nov 09, 2007 9:40 am

As I said in my first message you should type EXACTLY the following:
\(*\d{3}[\)\-\. ]*\d{3}[\-\.]*\d{4}
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

kleino
Posts: 12
Joined: Wed Nov 07, 2007 7:20 pm

Re: phone numbers various formats

Post by kleino » Sat Nov 10, 2007 3:03 am

I need to eliminate SPECIFIC phone numbers, not ALL phone numbers.

what do I type if I ONLY want to eliminate phone number 925-935-9251 and leave all other phone numbers unchanged?

If I use this as my search string \(*\d{3}[\)\-\. ]*\d{3}[\-\.]*\d{4}, wont this replace ALL phone numbers?

Abacre
Site Admin
Posts: 1198
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Re: phone numbers various formats

Post by Abacre » Sat Nov 10, 2007 10:44 am

\(*\d{3}[\)\-\. ]*\d{3}[\-\.]*\d{4} will eliminate all phone numbers.

If you want to eliminate just 925-935-9251 in various formats then you should use the expression:
\(*925[\)\-\. ]*935[\-\.]*9251
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests