Tuesday, 13 August 2013

Regular Expression to check the user input pattern

Regular Expression to check the user input pattern

My users enter some numbers in a textbox. The numbers format is
09XXXXXXXXX. The numbers are separated by Comma. like
09121234567,09351234568. I use the Regular Expression below to check the
user input.
^(09\d{9},?)+
Everything is ok but the problem is that if I enter 0912123456709351234568
it still matches this regexp. I want the user to enter at least one number
without comma but if the numbers are more than one then it should be
separated by comma. What is the right regexp?

No comments:

Post a Comment