Jump to content

Remember all the fun we had using regular expressions in Perl? You can use them in C# too! Ther...


G+_Joe Maruschek
 Share

Recommended Posts

Remember all the fun we had using regular expressions in Perl?  You can use them in C# too!  There is a class called Regex in the .NET Framework Class Library (FCL) that lets you do matching, searching and replacing, and splitting with regular expressions.  I wrote a small example program showing how you use the Regex class. 

 

For details about all the properties and methods you can use, check out the documentation here: http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex%28v=vs.110%29.aspx

 

The .NET FCL has thousands of classes for you to use in C#.  Browse the library at http://msdn.microsoft.com/en-us/library/gg145045(v=vs.110).aspx.  The classes are grouped into over 100 namespaces which group related classes together.  For example, the Regex class is in the System.Text.RegularExpressions namespace.

https://github.com/joemarus/csharp_part2_examples/blob/master/RegexExample.cs

Link to comment
Share on other sites

 Share

×
×
  • Create New...