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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Zoran HorvatRank #792 · 2.9K reputationPosted Aug 5, 2011, 3:26 AM EDT
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
Zoran HorvatRank #792 · 2.9K reputationPosted Aug 5, 2011, 2:46 AM EDT
\+\d\d ?\(\d\d\d\) ?\d+
This expression makes spaces optional, but country code and network code are mandatory.
Zoran
VulpesRank #55 · 29.2K reputationPosted Aug 5, 2011, 2:51 AM EDT
Dim r As New Regex("^\+91 (\(080\) 34567|9876678878|9876564567)$")
mahesh112 reputationPosted Aug 5, 2011, 3:19 AM EDT
mahesh112 reputationPosted Aug 5, 2011, 3:42 AM EDT
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Aug 5, 2011, 4:24 AM EDT