Assuming you are requiring the 1- and the area code:
1-[0-9]{3}-[0-9]{3}-[0-9]{4}
Something more flexible might be
((1-)?[0-9]{3}-)?[0-9]{3}-[0-9]{4}
HTH.
--Ben Doom
Che Vilnonis wrote:
> Real simple questionfolks...I use something like this to flag invalid
> zipcodes:
>
> <cfscript>
> if (NOT (REFind('^[[:digit:]]{5}(( |-)?[[:digit:]]{4})?$',FORM.ZIP) NEQ 0))
> {}
> </cfscript>
>
> What RegEx would work to validate a US phone number in a 1-888-555-1212
> format?
>
> Thank again...Che
>
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- RegEx Question... Che Vilnonis
- RE: RegEx Question... Ben Doom
- RE: RegEx Question... Che Vilnonis