Click here to Skip to main content
15,895,557 members

Search Strings Using Regular Expressions

Revision 1
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 MO no.", "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:33pm by SathyaRaju.
Tags: ,