Pulling international street addresses / phone numbers from free-form text

Posted by spitzanator on Stack Overflow See other posts from Stack Overflow or by spitzanator
Published on 2009-05-22T20:28:25Z Indexed on 2010/05/21 16:10 UTC
Read the original article Hit count: 172

Filed under:
|

Hey, folks. I'm looking for some regular expressions to help grab street addresses and phone numbers from free-form text (a la Gmail).

Given some text: "John, I went to the store today, and it was awesome! Did you hear that they moved to 500 Green St.? ... Give me a call at +14252425424 when you get a chance."

I'd like to be able to pull out:

500 Green St. (recognized as a street address)

+14252425424 (recognized as a phone number)

What makes this problem easier is that I don't care about parsing text that gets pulled out. That is, I don't care that Green is the name of the road or that 425 is the area code. I just want to grab strings that "look like" addresses or telephone numbers.

Unfortunately, this needs to work internationally, as best as possible.

Anyone have any leads? Thanks!

© Stack Overflow or respective owner

Related posts about regex

Related posts about street-address