Jump to content
UBot Underground

Regex for Scraping Phone Numbers


Recommended Posts

Here is a regex string that will match most variations of phone numbers in the North American format:

 

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

 

 

It matches 1112223333, 111.222.3333, 111-222-3333, 111 222 3333, (111) 222 3333 and all combinations thereof.

 

John

Link to post
Share on other sites

i'm trying to get this to work using your 'email scraping bot'

and just replacing the reg-ex for email with the one above for phone numbers.

 

the problem is when i run the bot on a given page it grabs all the text on the page

not just the phone number.

 

ever run into this before?

 

would love some help!

--Corey

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...