Regular Expression for finding phone numbers

Posted by Rocky on Stack Overflow See other posts from Stack Overflow or by Rocky
Published on 2010-05-16T01:57:22Z Indexed on 2010/05/16 9:20 UTC
Read the original article Hit count: 303

Filed under:
|

Hello Everyone,

I am new to Stackoverflow and I have a quick question. Let's assume we are given a large number of HTML files (large as in theoretically infinite). How can I use Regular Expressions to extract the list of Phone Numbers from all those files?

Explanation/expression will be really appreciated. The Phone numbers can be any of the following formats:

  • (123) 456 7899
  • (123).456.7899
  • (123)-456-7899
  • 123-456-7899
  • 123 456 7899
  • 1234567899

Thanks a lot for all your help and have a good one!

© Stack Overflow or respective owner

Related posts about regex

Related posts about phone-number