Regular Expression With Mask

Posted by Kumar on Stack Overflow See other posts from Stack Overflow or by Kumar
Published on 2010-04-11T08:06:49Z Indexed on 2010/04/11 8:13 UTC
Read the original article Hit count: 370

Filed under:

I have a regular expression for phone numbers as follows: ^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$

I have a mask on the phone number textbox in the following format: (___)___-____

How can I modify the regular expression so that it accommodates the mask?

© Stack Overflow or respective owner

Related posts about regex