This class represents a regular expression. Use it to search for
patterns in string data. It provides shared methods that search for
a pattern without explicitly creating
Regex instances as well as instance
methods that allow you to interact with a
The various shared methods employed by
Regex take the input string to search for
the first argument and the regular expression pattern string as the second. This is
equivalent to constructing a
Regex instance with
a pattern string, using it, and destroying
it immediately. Most methods are overloaded as instance
methods as well. These do not require a pattern argument, as this is provided
with the constructor.
search an input string for a single match or
all matches. Their overloads are the same. The first argument is the input
string. You can specify which position in the string the search should start at using a second
Match() also lets you specify the length of substring to search
after that position.
IsMatch() works the same way as
Match(), except that it
returns a boolean indicating whether the string contains a match.
Split() method acts like
System.String.Split() method. It uses
Regex pattern as a delimiter to split the input string into an array of substrings. (The delimiter is not included in the substrings.) You can provide a maximum number of substrings to return, in which case the last substring returned is the remainder ...