Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi Friends ,

I Have Small Problem ,

C#
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
Updated 24-Dec-12 22:35pm
v2

1 solution

Hi,

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

Hope this helps.
 
Share this answer
 
v2

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