Click here to Skip to main content
Sign Up to vote bad
good
See more: C#.NET
Hi Friends ,

I Have Small Problem ,
 
string sample1 = "AK12-13/000000029024";
            string Patten1 = "^\\[A-Za-z]{2}-\\d{2}/\\d{12}$";
            System.Text.RegularExpressions.Match match1 = System.Text.RegularExpressions.Regex.Match(sample1, Patten1, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            if (!match1.Success)
            {
                MessageBox.Show("Please enter a valid  Patten.", "TEST", MessageBoxButtons.OK, MessageBoxIcon.Warning);
 
                return;
            }
 
But its not working , Any one Plz to Help
Condisions:
 
• The first two digits have to be Alphabets “AK”
• Secondly, the 5th character has to be a “-”
• Thirdly, the 8th character has to be a “/”
• Finally the last 12 characters after the 8th place onwards have to be numeric.
Posted 24 Dec '12 - 22:33
Edited 24 Dec '12 - 22:35


1 solution

Hi,
 
Try this as Patten1 variable:
string Patten1 = "^AK.{2}-.{2}/[0-9]{12}$";
Hope this helps.
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 564
1 CPallini 245
2 Mahesh Bailwal 239
3 Maciej Los 235
4 Aarti Meswania 208
0 Sergey Alexandrovich Kryukov 9,162
1 OriginalGriff 7,179
2 CPallini 3,913
3 Rohan Leuva 3,176
4 Maciej Los 2,588


Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid