| Regex Class |
Namespace: System.Text.RegularExpressions
public class Regex
The Regex type exposes the following members.
| Name | Description | |
|---|---|---|
| Regex |
Initializes a new instance of the System.Text.RegularExpressions.Regex class.
| |
| Regex(String) |
Initializes a new instance of the System.Text.RegularExpressions.Regex class
for the specified regular expression.
| |
| Regex(String, RegexOptions) |
Initializes a new instance of the System.Text.RegularExpressions.Regex class
for the specified regular expression, with options that modify the pattern.
|
| Name | Description | |
|---|---|---|
| Equals(Object) | (Inherited from Object.) | |
| Escape |
Escapes a minimal set of characters (\, *, +, ?, |, {, [, (,), ^, $,., #,
and white space) by replacing them with their escape codes. This instructs
the regular expression engine to interpret these characters literally rather
than as metacharacters.
| |
| GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| IsMatch(String) |
Indicates whether the regular expression specified in the System.Text.RegularExpressions.Regex
constructor finds a match in a specified input string.
| |
| IsMatch(String, Int32) |
Indicates whether the regular expression specified in the System.Text.RegularExpressions.Regex
constructor finds a match in the specified input string, beginning at the
specified starting position in the string.
| |
| IsMatch(String, String) |
Indicates whether the specified regular expression finds a match in the specified
input string.
| |
| IsMatch(String, String, RegexOptions) |
Indicates whether the specified regular expression finds a match in the specified
input string, using the specified matching options.
| |
| Match(String) |
Searches the specified input string for the first occurrence of the regular
expression specified in the System.Text.RegularExpressions.Regex constructor.
| |
| Match(String, Int32) |
Searches the input string for the first occurrence of a regular expression,
beginning at the specified starting position in the string.
| |
| Match(String, String) |
Searches the specified input string for the first occurrence of the specified
regular expression.
| |
| Match(String, Int32, Int32) |
Searches the input string for the first occurrence of a regular expression,
beginning at the specified starting position and searching only the specified
number of characters.
| |
| Match(String, String, RegexOptions) |
Searches the input string for the first occurrence of the specified regular
expression, using the specified matching options. | |
| Matches(String) |
Searches the specified input string for all occurrences of a regular expression.
| |
| Matches(String, Int32) |
Searches the specified input string for all occurrences of a regular expression,
beginning at the specified starting position in the string.
| |
| Matches(String, String) |
Searches the specified input string for all occurrences of a specified regular
expression.
| |
| Matches(String, String, RegexOptions) |
Searches the specified input string for all occurrences of a specified regular
expression, using the specified matching options.
| |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| Replace(String, String) |
In a specified input string, replaces all strings that match a regular expression
pattern with a specified replacement string.
| |
| Replace(String, String, String) |
In a specified input string, replaces all strings that match a specified
regular expression with a specified replacement string.
| |
| Replace(String, String, String, RegexOptions) |
In a specified input string, replaces all strings that match a specified
regular expression with a specified replacement string. Specified options
modify the matching operation.
| |
| ToString |
Returns the regular expression pattern that was passed into the Regex constructor.
(Overrides ObjectToString.) | |
| Unescape |
Converts any escaped characters in the input string.
|
| Name | Description | |
|---|---|---|
| InfiniteMatchTimeout |
Specifies that a pattern-matching operation should not time out.
|
| Name | Description | |
|---|---|---|
| Options |
Gets the options that were passed into the System.Text.RegularExpressions.Regex
constructor.
| |
| RightToLeft |
Gets a value that indicates whether the regular expression searches from
right to left.
|
if (Regex.IsMatch(TextBoxEmailAddress.Text, @"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")) MessageBox.Show(TextBoxEmailAddress.Text + " is a valid email address."); else MessageBox.Show(TextBoxEmailAddress.Text + " is NOT a valid email address.");