Wednesday, 2 October 2013

Creating a regex that allows 9 or 10 digits

Creating a regex that allows 9 or 10 digits

I need help with a regex
I need it to match either a 9 or 10 digit value that starts with 50.
I have:
^[ ]*(50)[0-9]{7}[ ]*$
which allows 9 digits.
How can I expand this so that it also allows 10 digits?

No comments:

Post a Comment