validation expression for 10 digit and 13 digit for same text box

godirect
godirect used Ask the Experts™
on
HI,

 i should validate the same text box for 10 digit and 13 digit value in it.

I mean either they should enter their mobile number or account number.

Please help me.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
This should work: ^\d{10}|\d{13}$

Author

Commented:
That is only looking 10 one.. not ingnoring 10 if enter 13

Commented:
Yeah I see that, seems odd, let me see what I can figure out.
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

Commented:
Reversing the order appears to work: ^\d{13}|\d{10}$

Author

Commented:
I got it worked by doing this... (^\d{10}$)|(^\d{13}$)

Thank You for spending time on this.

Author

Commented:
it partly helped me

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial