System.Text.RegularExpressions Represents the results from a single successful subexpression capture. The position in the original string where the first character of the captured substring is found. The zero-based starting position in the original string where the captured substring is found. Gets the length of the captured substring. The length of the captured substring. Retrieves the captured substring from the input string by calling the property. The substring that was captured by the match. Gets the captured substring from the input string. The substring that is captured by the match. Represents the set of captures made by a single capturing group. Gets the number of substrings captured by the group. The number of items in the . Provides an enumerator that iterates through the collection. An object that contains all objects within the . Gets an individual member of the collection. The captured substring at position in the collection. Index into the capture collection. is less than 0 or greater than . Copies all the elements of the collection to the given array beginning at the given index. The one-dimensional array the collection is to be copied into. The zero-based index in the destination array where copying is to begin. is null. is outside the bounds of .-or- plus is outside the bounds of . Gets a value that indicates whether access to the collection is synchronized (thread-safe). false in all cases. Gets an object that can be used to synchronize access to the collection. A object that can be used to synchronize access to the collection. Represents the results from a single capturing group. Gets a collection of all the captures matched by the capturing group, in innermost-leftmost-first order (or innermost-rightmost-first order if the regular expression is modified with the option). The collection may have zero or more items. The collection of substrings matched by the group. Gets a value indicating whether the match is successful. true if the match is successful; otherwise, false. Returns the set of captured groups in a single match. Returns the number of groups in the collection. The number of groups in the collection. Provides an enumerator that iterates through the collection. An enumerator that contains all objects in the . Enables access to a member of the collection by integer index. The member of the collection specified by . The zero-based index of the collection member to be retrieved. Enables access to a member of the collection by string index. The member of the collection specified by . The name of a capturing group. Copies all the elements of the collection to the specified array beginning at the specified index. The one-dimensional array the collection is to be copied into. The zero-based index in the destination array where copying is to begin. is null. is outside the bounds of .-or- plus is outside the bounds of . Gets a value that indicates whether access to the collection is synchronized (thread-safe). false in all cases. Gets an object that can be used to synchronize access to the collection. An object that can be used to synchronize access to the collection. Represents the results from a single regular expression match. Gets the empty group. All failed matches return this empty match. An empty match. Gets a collection of groups matched by the regular expression. The character groups matched by the pattern. Returns a new object with the results for the next match, starting at the position at which the last match ended (at the character after the last matched character). The next regular expression match. A time-out occurred. Returns the expansion of the specified replacement pattern. The expanded version of the parameter. The replacement pattern to use. is null. Expansion is not allowed for this pattern. Represents the set of successful matches found by iteratively applying a regular expression pattern to the input string. Gets the number of matches. The number of matches. A time-out occurred. Provides an enumerator that iterates through the collection. An object that contains all objects within the . A time-out occurred. Gets an individual member of the collection. The captured substring at position in the collection. Index into the collection. is less than 0 or greater than or equal to . A time-out occurred. Copies all the elements of the collection to the specified array starting at the specified index. The one-dimensional array the collection is to be copied into. The zero-based index in the array where copying is to begin. is a multi-dimensional array. is outside the bounds of array.-or- plus is outside the bounds of . Gets a value that indicates whether access to the collection is synchronized (thread-safe). false in all cases. Gets an object that can be used to synchronize access to the collection. An object that can be used to synchronize access to the collection. This property always returns the object itself. Represents the method that is called each time a regular expression match is found during a method operation. A string returned by the method that is represented by the delegate. The object that represents a single regular expression match during a method operation. Represents an immutable regular expression.To browse the .NET Framework source code for this type, see the Reference Source. Initializes a new instance of the class. Initializes a new instance of the class for the specified regular expression. The regular expression pattern to match. A regular expression parsing error occurred. is null. Initializes a new instance of the class for the specified regular expression, with options that modify the pattern. The regular expression pattern to match. A bitwise combination of the enumeration values that modify the regular expression. A regular expression parsing error occurred. is null. contains an invalid flag. Initializes a new instance of the class for the specified regular expression, with options that modify the pattern and a value that specifies how long a pattern matching method should attempt a match before it times out. The regular expression pattern to match. A bitwise combination of the enumeration values that modify the regular expression. A time-out interval, or to indicate that the method should not time out. A regular expression parsing error occurred. is null. is not a valid value.-or- is negative, zero, or greater than approximately 24 days. Gets or sets the maximum number of entries in the current static cache of compiled regular expressions. The maximum number of entries in the static cache. The value in a set operation is less than zero. 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. A string of characters with metacharacters converted to their escaped form. The input string that contains the text to convert. is null. Returns an array of capturing group names for the regular expression. A string array of group names. Returns an array of capturing group numbers that correspond to group names in an array. An integer array of group numbers. Gets the group name that corresponds to the specified group number. A string that contains the group name associated with the specified group number. If there is no group name that corresponds to , the method returns . The group number to convert to the corresponding group name. Returns the group number that corresponds to the specified group name. The group number that corresponds to the specified group name, or -1 if is not a valid group name. The group name to convert to the corresponding group number. is null. Specifies that a pattern-matching operation should not time out. Indicates whether the regular expression specified in the constructor finds a match in a specified input string. true if the regular expression finds a match; otherwise, false. The string to search for a match. is null. A time-out occurred. For more information about time-outs, see the Remarks section. Indicates whether the regular expression specified in the constructor finds a match in the specified input string, beginning at the specified starting position in the string. true if the regular expression finds a match; otherwise, false. The string to search for a match. The character position at which to start the search. is null. is less than zero or greater than the length of . A time-out occurred. For more information about time-outs, see the Remarks section. Indicates whether the specified regular expression finds a match in the specified input string. true if the regular expression finds a match; otherwise, false. The string to search for a match. The regular expression pattern to match. A regular expression parsing error occurred. or is null. A time-out occurred. For more information about time-outs, see the Remarks section. Indicates whether the specified regular expression finds a match in the specified input string, using the specified matching options. true if the regular expression finds a match; otherwise, false. The string to search for a match. The regular expression pattern to match. A bitwise combination of the enumeration values that provide options for matching. A regular expression parsing error occurred. or is null. is not a valid value. A time-out occurred. For more information about time-outs, see the Remarks section. Indicates whether the specified regular expression finds a match in the specified input string, using the specified matching options and time-out interval. true if the regular expression finds a match; otherwise, false. The string to search for a match. The regular expression pattern to match. A bitwise combination of the enumeration values that provide options for matching. A time-out interval, or to indicate that the method should not time out. A regular expression parsing error occurred. or is null. is not a valid value.-or- is negative, zero, or greater than approximately 24 days. A time-out occurred. Searches the specified input string for the first occurrence of the regular expression specified in the constructor. An object that contains information about the match. The string to search for a match. is null. A time-out occurred. For more information about time-outs, see the Remarks section. Searches the input string for the first occurrence of a regular expression, beginning at the specified starting position in the string. An object that contains information about the match. The string to search for a match. The zero-based character position at which to start the search. is null. is less than zero or greater than the length of . A time-out occurred. For more information about time-outs, see the Remarks section. 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. An object that contains information about the match. The string to search for a match. The zero-based character position in the input string that defines the leftmost position to be searched. The number of characters in the substring to include in the search. is null. is less than zero or greater than the length of .-or- is less than zero or greater than the length of .-or-+– 1 identifies a position that is outside the range of . A time-out occurred. For more information about time-outs, see the Remarks section. Searches the specified input string for the first occurrence of the specified regular expression. An object that contains information about the match. The string to search for a match. The regular expression pattern to match. A regular expression parsing error occurred. or is null. A time-out occurred. For more information about time-outs, see the Remarks section. Searches the input string for the first occurrence of the specified regular expression, using the specified matching options. An object that contains information about the match. The string to search for a match. The regular expression pattern to match. A bitwise combination of the enumeration values that provide options for matching. A regular expression parsing error occurred. or is null. is not a valid bitwise combination of values. A time-out occurred. For more information about time-outs, see the Remarks section. Searches the input string for the first occurrence of the specified regular expression, using the specified matching options and time-out interval. An object that contains information about the match. The string to search for a match. The regular expression pattern to match. A bitwise combination of the enumeration values that provide options for matching. A time-out interval, or to indicate that the method should not time out. A regular expression parsing error occurred. or is null. is not a valid bitwise combination of values.-or- is negative, zero, or greater than approximately 24 days. A time-out occurred. For more information about time-outs, see the Remarks section. Searches the specified input string for all occurrences of a regular expression. A collection of the objects found by the search. If no matches are found, the method returns an empty collection object. The string to search for a match. is null. Searches the specified input string for all occurrences of a regular expression, beginning at the specified starting position in the string. A collection of the objects found by the search. If no matches are found, the method returns an empty collection object. The string to search for a match. The character position in the input string at which to start the search. is null. is less than zero or greater than the length of . Searches the specified input string for all occurrences of a specified regular expression. A collection of the objects found by the search. If no matches are found, the method returns an empty collection object. The string to search for a match. The regular expression pattern to match. A regular expression parsing error occurred. or is null. Searches the specified input string for all occurrences of a specified regular expression, using the specified matching options. A collection of the objects found by the search. If no matches are found, the method returns an empty collection object. The string to search for a match. The regular expression pattern to match. A bitwise combination of the enumeration values that specify options for matching. A regular expression parsing error occurred. or is null. is not a valid bitwise combination of values. Searches the specified input string for all occurrences of a specified regular expression, using the specified matching options and time-out interval. A collection of the objects found by the search. If no matches are found, the method returns an empty collection object. The string to search for a match. The regular expression pattern to match. A bitwise combination of the enumeration values that specify options for matching. A time-out interval, or to indicate that the method should not time out. A regular expression parsing error occurred. or is null. is not a valid bitwise combination of values.-or- is negative, zero, or greater than approximately 24 days. Gets the time-out interval of the current instance. The maximum time interval that can elapse in a pattern-matching operation before a is thrown, or if time-outs are disabled. Gets the options that were passed into the constructor. One or more members of the enumeration that represent options that were passed to the constructor In a specified input string, replaces all strings that match a regular expression pattern with a specified replacement string. A new string that is identical to the input string, except that the replacement string takes the place of each matched string. If the regular expression pattern is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. The replacement string. or is null. A time-out occurred. For more information about time-outs, see the Remarks section. In a specified input string, replaces a specified maximum number of strings that match a regular expression pattern with a specified replacement string. A new string that is identical to the input string, except that the replacement string takes the place of each matched string. If the regular expression pattern is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. The replacement string. The maximum number of times the replacement can occur. or is null. A time-out occurred. For more information about time-outs, see the Remarks section. In a specified input substring, replaces a specified maximum number of strings that match a regular expression pattern with a specified replacement string. A new string that is identical to the input string, except that the replacement string takes the place of each matched string. If the regular expression pattern is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. The replacement string. Maximum number of times the replacement can occur. The character position in the input string where the search begins. or is null. is less than zero or greater than the length of . A time-out occurred. For more information about time-outs, see the Remarks section. In a specified input string, replaces all strings that match a specified regular expression with a specified replacement string. A new string that is identical to the input string, except that the replacement string takes the place of each matched string. If is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. The regular expression pattern to match. The replacement string. A regular expression parsing error occurred. , , or is null. A time-out occurred. For more information about time-outs, see the Remarks section. 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. A new string that is identical to the input string, except that the replacement string takes the place of each matched string. If is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. The regular expression pattern to match. The replacement string. A bitwise combination of the enumeration values that provide options for matching. A regular expression parsing error occurred. , , or is null. is not a valid bitwise combination of values. A time-out occurred. For more information about time-outs, see the Remarks section. In a specified input string, replaces all strings that match a specified regular expression with a specified replacement string. Additional parameters specify options that modify the matching operation and a time-out interval if no match is found. A new string that is identical to the input string, except that the replacement string takes the place of each matched string. If is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. The regular expression pattern to match. The replacement string. A bitwise combination of the enumeration values that provide options for matching. A time-out interval, or to indicate that the method should not time out. A regular expression parsing error occurred. , , or is null. is not a valid bitwise combination of values.-or- is negative, zero, or greater than approximately 24 days. A time-out occurred. For more information about time-outs, see the Remarks section. In a specified input string, replaces all strings that match a specified regular expression with a string returned by a delegate. A new string that is identical to the input string, except that a replacement string takes the place of each matched string. If is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. The regular expression pattern to match. A custom method that examines each match and returns either the original matched string or a replacement string. A regular expression parsing error occurred. , , or is null. A time-out occurred. For more information about time-outs, see the Remarks section. In a specified input string, replaces all strings that match a specified regular expression with a string returned by a delegate. Specified options modify the matching operation. A new string that is identical to the input string, except that a replacement string takes the place of each matched string. If is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. The regular expression pattern to match. A custom method that examines each match and returns either the original matched string or a replacement string. A bitwise combination of the enumeration values that provide options for matching. A regular expression parsing error occurred. , , or is null. is not a valid bitwise combination of values. A time-out occurred. For more information about time-outs, see the Remarks section. In a specified input string, replaces all substrings that match a specified regular expression with a string returned by a delegate. Additional parameters specify options that modify the matching operation and a time-out interval if no match is found. A new string that is identical to the input string, except that the replacement string takes the place of each matched string. If is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. The regular expression pattern to match. A custom method that examines each match and returns either the original matched string or a replacement string. A bitwise combination of enumeration values that provide options for matching. A time-out interval, or to indicate that the method should not time out. A regular expression parsing error occurred. , , or is null. is not a valid bitwise combination of values.-or- is negative, zero, or greater than approximately 24 days. A time-out occurred. For more information about time-outs, see the Remarks section. In a specified input string, replaces all strings that match a specified regular expression with a string returned by a delegate. A new string that is identical to the input string, except that a replacement string takes the place of each matched string. If the regular expression pattern is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. A custom method that examines each match and returns either the original matched string or a replacement string. or is null. A time-out occurred. For more information about time-outs, see the Remarks section. In a specified input string, replaces a specified maximum number of strings that match a regular expression pattern with a string returned by a delegate. A new string that is identical to the input string, except that a replacement string takes the place of each matched string. If the regular expression pattern is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. A custom method that examines each match and returns either the original matched string or a replacement string. The maximum number of times the replacement will occur. or is null. A time-out occurred. For more information about time-outs, see the Remarks section. In a specified input substring, replaces a specified maximum number of strings that match a regular expression pattern with a string returned by a delegate. A new string that is identical to the input string, except that a replacement string takes the place of each matched string. If the regular expression pattern is not matched in the current instance, the method returns the current instance unchanged. The string to search for a match. A custom method that examines each match and returns either the original matched string or a replacement string. The maximum number of times the replacement will occur. The character position in the input string where the search begins. or is null. is less than zero or greater than the length of . A time-out occurred. For more information about time-outs, see the Remarks section. Gets a value that indicates whether the regular expression searches from right to left. true if the regular expression searches from right to left; otherwise, false. Splits an input string into an array of substrings at the positions defined by a regular expression pattern specified in the constructor. An array of strings. The string to split. is null. A time-out occurred. For more information about time-outs, see the Remarks section. Splits an input string a specified maximum number of times into an array of substrings, at the positions defined by a regular expression specified in the constructor. An array of strings. The string to be split. The maximum number of times the split can occur. is null. A time-out occurred. For more information about time-outs, see the Remarks section. Splits an input string a specified maximum number of times into an array of substrings, at the positions defined by a regular expression specified in the constructor. The search for the regular expression pattern starts at a specified character position in the input string. An array of strings. The string to be split. The maximum number of times the split can occur. The character position in the input string where the search will begin. is null. is less than zero or greater than the length of . A time-out occurred. For more information about time-outs, see the Remarks section. Splits an input string into an array of substrings at the positions defined by a regular expression pattern. An array of strings. The string to split. The regular expression pattern to match. A regular expression parsing error occurred. or is null. A time-out occurred. For more information about time-outs, see the Remarks section. Splits an input string into an array of substrings at the positions defined by a specified regular expression pattern. Specified options modify the matching operation. An array of strings. The string to split. The regular expression pattern to match. A bitwise combination of the enumeration values that provide options for matching. A regular expression parsing error occurred. or is null. is not a valid bitwise combination of values. A time-out occurred. For more information about time-outs, see the Remarks section. Splits an input string into an array of substrings at the positions defined by a specified regular expression pattern. Additional parameters specify options that modify the matching operation and a time-out interval if no match is found. A string array. The string to split. The regular expression pattern to match. A bitwise combination of the enumeration values that provide options for matching. A time-out interval, or to indicate that the method should not time out. A regular expression parsing error occurred. or is null. is not a valid bitwise combination of values.-or- is negative, zero, or greater than approximately 24 days. A time-out occurred. For more information about time-outs, see the Remarks section. Returns the regular expression pattern that was passed into the Regex constructor. The parameter that was passed into the Regex constructor. Converts any escaped characters in the input string. A string of characters with any escaped characters converted to their unescaped form. The input string containing the text to convert. includes an unrecognized escape sequence. is null. The exception that is thrown when the execution time of a regular expression pattern-matching method exceeds its time-out interval. Initializes a new instance of the class with a system-supplied message. Initializes a new instance of the class with the specified message string. A string that describes the exception. Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. A string that describes the exception. The exception that is the cause of the current exception. Initializes a new instance of the class with information about the regular expression pattern, the input text, and the time-out interval. The input text processed by the regular expression engine when the time-out occurred. The pattern used by the regular expression engine when the time-out occurred. The time-out interval. Gets the input text that the regular expression engine was processing when the time-out occurred. The regular expression input text. Gets the time-out interval for a regular expression match. The time-out interval. Gets the regular expression pattern that was used in the matching operation when the time-out occurred. The regular expression pattern. Provides enumerated values to use to set regular expression options. Specifies that the regular expression is compiled to an assembly. This yields faster execution but increases startup time. This value should not be assigned to the property when calling the method. For more information, see the "Compiled Regular Expressions" section in the Regular Expression Options topic. Specifies that cultural differences in language is ignored. For more information, see the "Comparison Using the Invariant Culture" section in the Regular Expression Options topic. Enables ECMAScript-compliant behavior for the expression. This value can be used only in conjunction with the , , and values. The use of this value with any other values results in an exception.For more information on the option, see the "ECMAScript Matching Behavior" section in the Regular Expression Options topic. Specifies that the only valid captures are explicitly named or numbered groups of the form (?<name>…). This allows unnamed parentheses to act as noncapturing groups without the syntactic clumsiness of the expression (?:…). For more information, see the "Explicit Captures Only" section in the Regular Expression Options topic. Specifies case-insensitive matching. For more information, see the "Case-Insensitive Matching " section in the Regular Expression Options topic. Eliminates unescaped white space from the pattern and enables comments marked with #. However, this value does not affect or eliminate white space in character classes, numeric quantifiers, or tokens that mark the beginning of individual regular expression language elements. For more information, see the "Ignore White Space" section of the Regular Expression Options topic. Multiline mode. Changes the meaning of ^ and $ so they match at the beginning and end, respectively, of any line, and not just the beginning and end of the entire string. For more information, see the "Multiline Mode" section in the Regular Expression Options topic. Specifies that no options are set. For more information about the default behavior of the regular expression engine, see the "Default Options" section in the Regular Expression Options topic. Specifies that the search will be from right to left instead of from left to right. For more information, see the "Right-to-Left Mode" section in the Regular Expression Options topic. Specifies single-line mode. Changes the meaning of the dot (.) so it matches every character (instead of every character except \n). For more information, see the "Single-line Mode" section in the Regular Expression Options topic.