Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am writing to seek advice, as to where I may be going wrong in the following Regex expression below:
C#
var input = "97.2525, M45s, 130.5, +129s, 145s";

    foreach(var match in Regex.Matches(input,@"\+\d+([1-9]\d{2,})\[AS]"))
    {

        Console.WriteLine(match);

    }


the output from this code should be the following values "+129s, 145s".
Thank you in advance for your help and time.
Posted

1 solution

Try:
\+(\d{2,}[ASas]\,?\s?){2}

If you are going to work with Regexes, get a copy of Expresso [^] - it's free, and it examines and generates Regular expressions. I wish I'd written it!
 
Share this answer
 

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