Click here to Skip to main content
11,642,613 members (71,172 online)
Rate this: bad
Please Sign up or sign in to vote.
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);

But its not working , Any one Plz to Help

• 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:33pm
Edited 24-Dec-12 22:35pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


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

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

Advertise | Privacy | Mobile
Web03 | 2.8.150731.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100