Validation with regular expressions: Allow two formats

September 11, 2009 Javascript Actionscript ASP.NET Validation Regular expressions Snippet
Here's a nice piece of regular expression submitted by Nils that allow validation against two different formats, in this case 10 or 12 numbers:
^[0-9]{10}(?: [0-9]{2})?$

Related posts: