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);




Also, check this out :


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s