Dear All,
I want validate cell phone field in vb.net by using regular expression.it should accept only +91 (080) 34567 and +91 9876678878 and 9876564567.Can any one help me?
Thanks in advance.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Zoran HorvatPosted Aug 5, 2011, 7:26 AM
Solution is to make (080) and tailing space otpional:
\+\d\d (\(\d\d\d\) )?\d+
But in this case first space is mandatory, to ensure that country code is separated from other content.
Zoran
Jiteendra SampathiraoPosted Aug 5, 2011, 8:24 AM
maheshPosted Aug 5, 2011, 7:42 AM
maheshPosted Aug 5, 2011, 7:19 AM
VulpesPosted Aug 5, 2011, 6:51 AM
Dim r As New Regex("^\+91 (\(080\) 34567|9876678878|9876564567)$")
Zoran HorvatPosted Aug 5, 2011, 6:46 AM
\+\d\d ?\(\d\d\d\) ?\d+
This expression makes spaces optional, but country code and network code are mandatory.
Zoran