Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Please help me to write Regular Function for AA5262525622222

i m Using
Regex.IsMatch("[A-Z]{2}\d{14}", "AA5262525622222")
or
Regex.IsMatch("[A-Z]{2}[1-9]{14}", "AA5262525622222")

But it Returns false .
Posted
Updated 13-May-14 0:59am
v3
Comments
[no name] 13-May-14 6:59am    
I am sorry. The telepathic helmet I usually use to read people's minds asking questions is in the shop this week. You will have to actually tell us what you want the RegEx to do and please include the RegEx that you have written that attempts to do whatever it is that you are trying to do and describe what the problem is. Thank you for your understanding.
Legor 13-May-14 7:05am    
At least you have to tell us what you want to extract with your regex.

Try:
[A-Z]{2}\d{13}


If you are going to play with regexes, then get a copy of Expresso [^] - it's free, and it examines and generates Regular expressions.
 
Share this answer
 
Comments
Naim_86 13-May-14 7:22am    
Its not working <br>
Actualy i want to check only starting 2 or 3 char is Alphanumeric and rest of this is numeric<br>
 <br>
Please Help
OriginalGriff 13-May-14 7:26am    
So try:
[A-Z]{2,3}\d+

Seriously, look at Espresso - you can work simple ones like this out quicker than asking here! :laugh:
Prasad Khandekar 13-May-14 7:26am    
You can use [A-Z]{2,3}\d+

Sorry Griff did not look at your reply.
Prasad Khandekar 13-May-14 7:25am    
+5
You should have stated it clearly, we can't read you mind. try this:
^[A-Z]{2,3}\d{12,13}$

This will work for 2 to 3 leading capital alphabets followed by all digits, total length is 15.
 
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