Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want a regex or a code to validate indain phone number without including country code +91.I want to validate only 10 digits.It should start with 7,8 or 9 and it should no allow numbers like all [7|8|9] , & like 4 or 5 or 6 digits consecutive [7|8|9] & rest 6 or 5 or 4 digits [7|8|9].I WANT THIS IN VB PLEASE.

What I have tried:

I tried something but not works
Posted
Updated 24-Mar-18 5:49am
Comments
Vineeth 677 24-Mar-18 11:11am    
Not Vb old it's vb & I am not good in grammar
Patrice T 24-Mar-18 11:13am    
Use Improve question to update your question.

Regex's are language neutral, so VB, C++, C# are all the same. Go to RegExr: Learn, Build, & Test RegEx[^] where you can find a sample and easily test it for yourself. BTW, it is not urgent.
 
Share this answer
 
Quote:
I want regex or code in VB old it's urgent.

I want to win Lotto, it's urgent, can you help ?

Quote:
I tried something but not works

I don't see what is wrong in your try. (try to show what you have done)
Try more, or try something else.

Quote:
It should start with 7,8 or 9 and it should no allow numbers like all [7|8|9] , & like 4 or 5 or 6 digits consecutive [7|8|9] & rest 6 or 5 or 4 digits [7|8|9]

Do you have knowledge that those numbers do not exist ?
or they are just unlikely? because every single number is as unlikely as any other one.
-----
Quote:
It should start with 7,8 or 9 and it should no allow numbers like all [7|8|9] , & like 4 or 5 or 6 digits consecutive [7|8|9] & rest 6 or 5 or 4 digits [7|8|9]

This is not the usage of RegEx, regex is for pattern matching. Checking that the first digit is 7, 8 or 9 is ok, but it is not for the rejecting of the other sequence numbers.

A little regEx "[789]\d+" to get you started.

Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
RegExr: Learn, Build, & Test RegEx[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900