http://qs1969.pair.com?node_id=157490


in reply to Simple Regex

Another thing you might want to consider is looking in the string for an "x" somewhere, grabbing the characters after it which include at least one number, up to the first space you see, and moving that whole string (x 534, ext 611, xt9411, etc) to the back of the overall string, in order to ensure that the number string you have left over once you've done your s/\D*/g has the areacode and phonenumber at the beginning.

If you have ext 433 (505)666-7777, you don't want to just strip the non digit chars and substr the first 10 digits as the phone number.

Of course, if you know that the phone numbers always have the extension second (because of the way they were put into the database) then you don't have to worry about it.

Good luck.

-il cylic