Learn .NET Framework Regular ExpressionsJul 06, 2015
Regular expressions provide a powerful, flexible, and efficient method for processing text. The extensive pattern-matching notation of regular expressions enables you to quickly parse large amounts of text to find specific character patterns,to validate text to ensure that it matches a predefined pattern (such as an e-mail address),to extract, edit, replace, or delete text substrings and to add the extracted strings to a collection in order to generate a report. For many applications that deal with strings or that parse large blocks of text, regular expressions are an indispensable tool.
The regular expression engine in the .NET Framework is represented by the Regex class. The regular expression engine is responsible for parsing and compiling a regular expression, and for performing operations that match the regular expression pattern with an input string. The engine is the central component in the .NET Framework regular expression object model.
You can call the methods of the Regex class to perform the following operations:
- Determine whether a string matches a regular expression pattern.
- Extract a single match or the first match.
- Extract all matches.
- Replace a matched substring.
- Split a single string into an array of strings.