This is what your ValidationExpression property should look like:
((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}( x\d{0,})?
Copy and paste this string into the ValidationExpression property of your Regular Expression Validator control. What I did was add “( x\d{0,})?” to the end of the string (without the quotes) that Microsoft provided for us. My example allows a user to enter a phone number with an extension formatted as: (770)123-4567 x1234. If you prefer to use “ext” for extension, simply edit the above string and replace “x” with “ext”. Make sure that your database field is big enough to accommodate the entire phone number and extension – at least varchar(25) in our case.
So how did I figure out what characters to use to create this validation string? It’s called Regular Expressions. Check out or search for this excellent tutorial on Microsoft’s MSDN site: Regular Expressions in ASP.NET
by Carl Ernest