Skip to content

Validate strings with Regx in C#

Mahendranath

Asked Aug 26, 2009, 10:01 PM EDT1 answer
Share
LinkedInX
I am using C# windows application of 2.0 .net Frame work. How to validate the string formats like  project#, 1.project or 2.project, project:, project#1:, project#2:, project# 2 etc using regular expressions.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Try with this. It will help full.....

    using System.Text.RegularExpressions;

    Regex myRegEx = new Regex("([0-9]+)*([^a-zA-z0-9])*[\s]*[a-zA-Z]+(#+)*[\s]*([0-9]+)*[\s]*([^a-zA-z0-9])*$");
    0