Expression |
^\D{0,2}[0]{0,3}[1]{0,1}\D{0,2}([2-9])(\d{2})\D{0,2}(\d{3})\D{0,2}(\d{3})\D{0,2}(\d{1})\D{0,2}$ |
Description |
Very useful if you want to use ANY-NON-DIGIT as delimiter and return proper US-Phone-Number. Use "($1) $2-$3$4" to get Number in form: "(234) 567-8901".
Will ignore starting 1, 01, 001, +1 etc.
Validates and also captures AreaCode, Prefix and Suffix for reformatting.
In all matching examples, it will return the same result. I have not found any exception yet. |