I'm trying to figure out how to write a validation expression that would allow these formats : (xxx)xxx-xxxx , 123456789
anyone know of any validation expressions that is somewhat like that or exactly like that or better ?
Printable View
I'm trying to figure out how to write a validation expression that would allow these formats : (xxx)xxx-xxxx , 123456789
anyone know of any validation expressions that is somewhat like that or exactly like that or better ?
Take a look at http://regexlib.com/
well, for your first example (xxx) xxx-xxxx , the expression would be
^\([2-9]\d{2}\) \d{3}[- .]?\d{4}\D*(\d*)$
and for your second example, xxxxxxxxxx , the expression would be short and simple....
^\d{10}$
good luck!