Subject: Labor Day your weight-loss deadline?

From: Weight-Loss Report <[email-masked]>
Date: Tue, 26 Aug 2014 10:46:41 -0700

Street Style: Fall 2014

In the world of Fashion, fall is the time for new beginnings. 
A time to reset your wardrobe and welcome in new trends. 

Now you don't have to watch other women wearing skinny jeans, tucked in shirts and LBD's. 

With this 1 step from DocOz you could be down 7 LBS by Labor Day.

View How Here -> http://www.shedwhyrip.com/fall/2014/tip.html

- August 26, 2014 

-
-
-
TO stop further messages - write Alert Center Notifications
 at 1400 South Jama Goddard, KS 67052 or visit http://www.shedwhyrip.com/35y/u8i/w34/2f.jo09
-
-
-
The original problem is trying to handle phone number validation because it was trying to handle all the possible formatting options. Rather than try to solve all that, take the input and "pre-strip" it of all formatting fluff until you have just the "number". Doing this solves 2 problems - testing the result is now easy and you can now ensure that values rendered back out for display can all be formatted consistently. The first phone number, which this kind of solves, and determining if what a user typed in, is in fact a valid phone number, which this does not solve at all. If you want validation, i.e. determining if a string is a valid phone number, this doesn't do that. The questions asks about validation, not formatting. Of course the author of the  you do this in php? you can use $justDigitsOrPlusOrX = preg_replace("/[^\d+x]/", "", $phoneNum); to strip away all the chars you don't need... then test the remaining (if needed) I suppose in those scenarios if that's what you really 
 wanted you could enable a smart translation that would convert the letters to their matching numbers... but I think that's a very special corner case compared to what most folks are after. above: /[^\d+x]|x(?=[^x]*x)/gi but it does not answer the posed question that explicitly requests a RegEx solution. this has over 200 points but does not actually answer the question did you read the article linked in the first comment added by Nicholas Trandem the Original Question Poster? Sometimes (as you can see how the community has voted) even though there is a solution to use a 261 character regex that handles a bunch of scenarios... trying to attack the problem in a different manner is actually the answer you want. Note Dave Kirby's answer also suggests not using a strict regex... also gaining (ATM 79 upvotes)  I have had Jeffrey Friedl's book beside me on my desk for the past two years, as regular expressions are a major part of my work. It takes a good while to really understand regular 
 expressions. Sometimes, the readers of this site are simply looking for an existing soltuion, rather than writing their own, especially in domains with lots of corner cases, such as phone number representations. I understand that, but majority of the responses here are "me too" type of one-off regular expressions that likely don't fit any of your corner cases. These then end up on all the websites I'm trying to use and I can't enter my zip code or phone number or email address because someone used a half-baked regular-expression (eg: + is a valid character in email addresses). The best responses on this page point users to libraries, not to napkin-scrawled regexes