Regex in C#

Recent had to ramp up on my regex skills. i was using C#,  so decided to explore the Regex libs in C#

Some use cases.

  • Finding matches.
    • Lets say I want to extract all the numbers present in a string.
    • I identify the proper regex to use. So in this case “\d+”
    • Use Regex.matches. e.g.
var digitsGroups = Regex.Matches(username, @"\d+", RegexOptions.IgnoreCase);

 

Code.

 

Also, check this out : http://www.ultrapico.com/Expresso.htm

References.