PHP matching a string

Posted by John Jones on Stack Overflow See other posts from Stack Overflow or by John Jones
Published on 2010-03-02T15:17:58Z Indexed on 2010/03/12 12:47 UTC
Read the original article Hit count: 272

Filed under:

Hi,

I have an Indian company data set and need to extract the City and Zip from the address field:

Address Field Example: Gowripuram West, Sengunthapuram Post, Near L.G.B., Karur, Tamilnadu, Karur - 639 002, India

As you can see the City is Karur and the zip is followed after the - (hyphen).

I need the PHP code to match [city] - [zip]

Not sure how to do this I can find the Zip after the Hypen but not sure how to find the City, please note the City can be 2 words.

Cheers for your time./

J

© Stack Overflow or respective owner

Related posts about php