System.Text.RegularExpressions.zh
System.Text.RegularExpressions.Capture
Represents the results from a single successful subexpression capture.
System.Text.RegularExpressions.Capture.ToString
Retrieves the captured substring from the input string by calling the System.Text.RegularExpressions.Capture.Value property.
Returns
The substring that was captured by the match.
System.Text.RegularExpressions.Capture.Index
The position in the original string where the first character of the captured substring is found.
Returns
The zero-based starting position in the original string where the captured substring is found.
System.Text.RegularExpressions.Capture.Length
Gets the length of the captured substring.
Returns
The length of the captured substring.
System.Text.RegularExpressions.Capture.Value
Gets the captured substring from the input string.
Returns
The substring that is captured by the match.
System.Text.RegularExpressions.Capture.ValueSpan
Gets the captured span from the input string.
Returns
The span that is captured by the match.
System.Text.RegularExpressions.CaptureCollection
Represents the set of captures made by a single capturing group. The collection is immutable (read-only) and has no public constructor.
System.Text.RegularExpressions.CaptureCollection.CopyTo()
Copies all the elements of the collection to the given array beginning at the given index.
Parameters
| Name | Description | Default |
|---|---|---|
array |
The array the collection is to be copied into. | |
arrayIndex |
The position in the destination array where copying is to begin. |
System.Text.RegularExpressions.CaptureCollection.CopyTo()
Copies the elements of the collection to an System.Array, starting at a particular System.Array index.
Parameters
| Name | Description | Default |
|---|---|---|
array |
The one-dimensional System.Array that is the destination of the elements copied from the collection. The System.Array must have zero-based indexing. | |
arrayIndex |
The zero-based index in array at which copying begins. |
System.Text.RegularExpressions.CaptureCollection.GetEnumerator
Provides an enumerator that iterates through the collection.
Returns
An object that contains all System.Text.RegularExpressions.Capture objects within the System.Text.RegularExpressions.CaptureCollection.
System.Text.RegularExpressions.CaptureCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Capture}#Add()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The object to add to the collection. |
System.Text.RegularExpressions.CaptureCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Capture}#Clear
Calling this method always throws System.NotSupportedException.
System.Text.RegularExpressions.CaptureCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Capture}#Contains()
Determines whether the collection contains a specific value.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The object to locate in the collection. |
Returns
System.Text.RegularExpressions.CaptureCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Capture}#Remove()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The object to remove from the collection. |
Returns
Calling this method always throws System.NotSupportedException.
System.Text.RegularExpressions.CaptureCollection.System#Collections#Generic#IEnumerable{System#Text#RegularExpressions#Capture}#GetEnumerator
Returns an enumerator that iterates through the collection.
Returns
An enumerator that can be used to iterate through the collection.
System.Text.RegularExpressions.CaptureCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Capture}#IndexOf()
Determines the index of a specific item in the collection.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The object to locate in the collection. |
Returns
The index of item if found in the list; otherwise, -1.
System.Text.RegularExpressions.CaptureCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Capture}#Insert()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index at which item should be inserted. | |
item |
The object to insert into the collection. |
System.Text.RegularExpressions.CaptureCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Capture}#RemoveAt()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index of the item to remove. |
System.Text.RegularExpressions.CaptureCollection.System#Collections#IList#Add()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The object to add to the collection. |
Returns
Calling this method always throws System.NotSupportedException.
System.Text.RegularExpressions.CaptureCollection.System#Collections#IList#Clear
Calling this method always throws System.NotSupportedException.
System.Text.RegularExpressions.CaptureCollection.System#Collections#IList#Contains()
Determines whether the collection contains a specific value.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The object to locate in the collection. |
Returns
System.Text.RegularExpressions.CaptureCollection.System#Collections#IList#IndexOf()
Determines the index of a specific item in the collection.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The object to locate in the collection. |
Returns
The index of value if found in the list; otherwise, -1.
System.Text.RegularExpressions.CaptureCollection.System#Collections#IList#Insert()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index at which value should be inserted. | |
value |
The object to insert into the collection. |
System.Text.RegularExpressions.CaptureCollection.System#Collections#IList#Remove()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The object to remove from the collection. |
System.Text.RegularExpressions.CaptureCollection.System#Collections#IList#RemoveAt()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index of the item to remove. |
System.Text.RegularExpressions.CaptureCollection.Count
Gets the number of substrings captured by the group.
Returns
The number of items in the System.Text.RegularExpressions.CaptureCollection.
System.Text.RegularExpressions.CaptureCollection.IsReadOnly
Gets a value that indicates whether the collection is read only.
Returns
true in all cases.
System.Text.RegularExpressions.CaptureCollection.IsSynchronized
Gets a value that indicates whether access to the collection is synchronized (thread-safe).
Returns
false in all cases.
System.Text.RegularExpressions.CaptureCollection.Item()
Gets an individual member of the collection.
Parameters
| Name | Description | Default |
|---|---|---|
i |
Index into the capture collection. |
Returns
The captured substring at position i in the collection.
System.Text.RegularExpressions.CaptureCollection.SyncRoot
Gets an object that can be used to synchronize access to the collection.
Returns
An object that can be used to synchronize access to the collection.
System.Text.RegularExpressions.CaptureCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Capture}#Item()
Gets the element at the specified index.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index of the element to get. |
Returns
The element at the specified index.
System.Text.RegularExpressions.CaptureCollection.System#Collections#IList#IsFixedSize
Gets a value indicating whether the collection has a fixed size.
Returns
true, since the collection has a fixed size.
System.Text.RegularExpressions.CaptureCollection.System#Collections#IList#Item()
Gets the element at the specified index.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index of the element to get. |
Returns
The element at the specified index.
System.Text.RegularExpressions.GeneratedRegexAttribute
Instructs the System.Text.RegularExpressions source generator to generate an implementation of the specified regular expression.
System.Text.RegularExpressions.GeneratedRegexAttribute.#ctor()
Initializes a new instance of System.Text.RegularExpressions.GeneratedRegexAttribute with the specified pattern.
Parameters
| Name | Description | Default |
|---|---|---|
pattern |
The regular expression pattern to match. |
System.Text.RegularExpressions.GeneratedRegexAttribute.#ctor()
Initializes a new instance of System.Text.RegularExpressions.GeneratedRegexAttribute with the specified pattern and options.
Parameters
| Name | Description | Default |
|---|---|---|
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that modify the regular expression. |
System.Text.RegularExpressions.GeneratedRegexAttribute.#ctor()
Initializes a new instance of System.Text.RegularExpressions.GeneratedRegexAttribute with the specified pattern, options, and time-out value.
Parameters
| Name | Description | Default |
|---|---|---|
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that modify the regular expression. | |
matchTimeoutMilliseconds |
A time-out interval (milliseconds), or System.Threading.Timeout.Infinite to indicate that the method should not time out. |
System.Text.RegularExpressions.GeneratedRegexAttribute.#ctor()
Initializes a new instance of System.Text.RegularExpressions.GeneratedRegexAttribute with the specified pattern, options, time-out value, and culture.
Parameters
| Name | Description | Default |
|---|---|---|
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that modify the regular expression. | |
matchTimeoutMilliseconds |
A time-out interval (milliseconds), or System.Threading.Timeout.Infinite to indicate that the method should not time out. | |
cultureName |
The name of a culture to be used for case sensitive comparisons. cultureName is not case-sensitive. |
System.Text.RegularExpressions.GeneratedRegexAttribute.#ctor()
Initializes a new instance of System.Text.RegularExpressions.GeneratedRegexAttribute with the specified pattern and options.
Parameters
| Name | Description | Default |
|---|---|---|
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that modify the regular expression. | |
cultureName |
The name of a culture to be used for case sensitive comparisons. cultureName is not case-sensitive. |
System.Text.RegularExpressions.GeneratedRegexAttribute.CultureName
Gets the name of the culture to be used for case sensitive comparisons.
System.Text.RegularExpressions.GeneratedRegexAttribute.MatchTimeoutMilliseconds
Gets a time-out interval (milliseconds), or System.Threading.Timeout.Infinite to indicate that the method should not time out.
System.Text.RegularExpressions.GeneratedRegexAttribute.Options
Gets a bitwise combination of the enumeration values that modify the regular expression.
System.Text.RegularExpressions.GeneratedRegexAttribute.Pattern
Gets the regular expression pattern to match.
System.Text.RegularExpressions.Group
Represents the results from a single capturing group.
System.Text.RegularExpressions.Group.Synchronized()
Returns a Group object equivalent to the one supplied that is safe to share between multiple threads.
Parameters
| Name | Description | Default |
|---|---|---|
inner |
The input System.Text.RegularExpressions.Group object. |
Returns
A regular expression Group object.
System.Text.RegularExpressions.Group.Captures
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 System.Text.RegularExpressions.RegexOptions.RightToLeft option). The collection may have zero or more items.
Returns
The collection of substrings matched by the group.
System.Text.RegularExpressions.Group.Name
Returns the name of the capturing group represented by the current instance.
Returns
The name of the capturing group represented by the current instance.
System.Text.RegularExpressions.Group.Success
Gets a value indicating whether the match is successful.
Returns
System.Text.RegularExpressions.GroupCollection
Returns the set of captured groups in a single match. The collection is immutable (read-only) and has no public constructor.
System.Text.RegularExpressions.GroupCollection.ContainsKey()
Determines whether the group collection contains a captured group identified by the specified name.
Parameters
| Name | Description | Default |
|---|---|---|
key |
A string with the name of the captured group to locate. |
Returns
System.Text.RegularExpressions.GroupCollection.CopyTo()
Copies all the elements of the collection to the given array beginning at the given index.
Parameters
| Name | Description | Default |
|---|---|---|
array |
The array the collection is to be copied into. | |
arrayIndex |
The position in the destination array where the copying is to begin. |
System.Text.RegularExpressions.GroupCollection.CopyTo()
Copies the elements of the group collection to a System.Text.RegularExpressions.Group array, starting at a particular array index.
Parameters
| Name | Description | Default |
|---|---|---|
array |
The one-dimensional array that is the destination of the elements copied from the group collection. The array must have zero-based indexing. | |
arrayIndex |
The zero-based index in array at which copying begins. |
System.Text.RegularExpressions.GroupCollection.GetEnumerator
Provides an enumerator that iterates through the collection.
Returns
An enumerator that contains all System.Text.RegularExpressions.Group objects in the System.Text.RegularExpressions.GroupCollection.
System.Text.RegularExpressions.GroupCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Group}#Add()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The group to add to the collection. |
System.Text.RegularExpressions.GroupCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Group}#Clear
Calling this method always throws System.NotSupportedException.
System.Text.RegularExpressions.GroupCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Group}#Contains()
Determines whether the group collection contains a specific group item.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The group to locate in the group collection. |
Returns
System.Text.RegularExpressions.GroupCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Group}#Remove()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The group to remove. |
Returns
Calling this method always throws System.NotSupportedException.
System.Text.RegularExpressions.GroupCollection.System#Collections#Generic#IEnumerable{System#Collections#Generic#KeyValuePair{System#String@System#Text#RegularExpressions#Group}}#GetEnumerator
Provides an enumerator that iterates through the group collection.
Returns
An enumerator that contains all names and objects in the System.Text.RegularExpressions.Group collection.
System.Text.RegularExpressions.GroupCollection.System#Collections#Generic#IEnumerable{System#Text#RegularExpressions#Group}#GetEnumerator
Provides an enumerator that iterates through the group collection.
Returns
An enumerator that contains all System.Text.RegularExpressions.Group objects in the group collection.
System.Text.RegularExpressions.GroupCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Group}#IndexOf()
Determines the index of a specific group in the group collection.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The group to locate in the group collection. |
Returns
The index of the item if found; otherwise, -1.
System.Text.RegularExpressions.GroupCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Group}#Insert()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The position at which to insert the group. | |
item |
The group to insert. |
System.Text.RegularExpressions.GroupCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Group}#RemoveAt()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index of the group to remove. |
System.Text.RegularExpressions.GroupCollection.System#Collections#IList#Add()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The object to add to the group collection. |
Returns
Calling this method always throws System.NotSupportedException.
System.Text.RegularExpressions.GroupCollection.System#Collections#IList#Clear
Calling this method always throws System.NotSupportedException.
System.Text.RegularExpressions.GroupCollection.System#Collections#IList#Contains()
Determines whether the group collection contains a specific group item.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The group to locate in the group collection. |
Returns
System.Text.RegularExpressions.GroupCollection.System#Collections#IList#IndexOf()
Determines the index of a specific group in the group collection.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The group to locate in the group collection. |
Returns
The index of the item if found; otherwise, -1.
System.Text.RegularExpressions.GroupCollection.System#Collections#IList#Insert()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The position at which to insert the group. | |
value |
The group to insert. |
System.Text.RegularExpressions.GroupCollection.System#Collections#IList#Remove()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The group to remove. |
System.Text.RegularExpressions.GroupCollection.System#Collections#IList#RemoveAt()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index of the group to remove. |
System.Text.RegularExpressions.GroupCollection.TryGetValue()
Attempts to retrieve a group identified by the provided name key, if it exists in the group collection.
Parameters
| Name | Description | Default |
|---|---|---|
key |
A string with the group name key to look for. | |
value |
When the method returns, the group whose name is key, if it is found; otherwise, null if not found. |
Returns
System.Text.RegularExpressions.GroupCollection.Count
Returns the number of groups in the collection.
Returns
The number of groups in the collection.
System.Text.RegularExpressions.GroupCollection.IsReadOnly
Gets a value that indicates whether the collection is read-only.
Returns
true in all cases.
System.Text.RegularExpressions.GroupCollection.IsSynchronized
Gets a value that indicates whether access to the System.Text.RegularExpressions.GroupCollection is synchronized (thread-safe).
Returns
false in all cases.
System.Text.RegularExpressions.GroupCollection.Item()
Enables access to a member of the collection by integer index.
Parameters
| Name | Description | Default |
|---|---|---|
groupnum |
The zero-based index of the collection member to be retrieved. |
Returns
The member of the collection specified by groupnum.
System.Text.RegularExpressions.GroupCollection.Item()
Enables access to a member of the collection by string index.
Parameters
| Name | Description | Default |
|---|---|---|
groupname |
The name of a capturing group. |
Returns
The member of the collection specified by groupname.
System.Text.RegularExpressions.GroupCollection.Keys
Gets a string enumeration that contains the name keys of the group collection.
Returns
The name keys of the group collection.
System.Text.RegularExpressions.GroupCollection.SyncRoot
Gets an object that can be used to synchronize access to the System.Text.RegularExpressions.GroupCollection.
Returns
A copy of the System.Text.RegularExpressions.Match object to synchronize.
System.Text.RegularExpressions.GroupCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Group}#Item()
Gets the group at the specified position in the collection.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index of the group in the group collection. |
Returns
The group in the desired position.
System.Text.RegularExpressions.GroupCollection.System#Collections#IList#IsFixedSize
Gets a value indicating whether the group collection has a fixed size.
Returns
true always.
System.Text.RegularExpressions.GroupCollection.System#Collections#IList#Item()
Gets the group in the desired position.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-index position of the group in the group collection. |
Returns
The group in the desired position.
System.Text.RegularExpressions.GroupCollection.Values
Gets a group enumeration with all the groups in the group collection.
Returns
A group enumeration.
System.Text.RegularExpressions.Match
Represents the results from a single regular expression match.
System.Text.RegularExpressions.Match.NextMatch
Returns a new System.Text.RegularExpressions.Match 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).
Returns
The next regular expression match.
System.Text.RegularExpressions.Match.Result()
Returns the expansion of the specified replacement pattern.
Parameters
| Name | Description | Default |
|---|---|---|
replacement |
The replacement pattern to use. |
Returns
The expanded version of the replacement parameter.
System.Text.RegularExpressions.Match.Synchronized()
Returns a System.Text.RegularExpressions.Match instance equivalent to the one supplied that is suitable to share between multiple threads.
Parameters
| Name | Description | Default |
|---|---|---|
inner |
A regular expression match equivalent to the one expected. |
Returns
A regular expression match that is suitable to share between multiple threads.
System.Text.RegularExpressions.Match.Empty
Gets the empty group. All failed matches return this empty match.
Returns
An empty match.
System.Text.RegularExpressions.Match.Groups
Gets a collection of groups matched by the regular expression.
Returns
The character groups matched by the pattern.
System.Text.RegularExpressions.MatchCollection
Represents the set of successful matches found by iteratively applying a regular expression pattern to the input string. The collection is immutable (read-only) and has no public constructor. The System.Text.RegularExpressions.Regex.Matches() method returns a System.Text.RegularExpressions.MatchCollection object.
System.Text.RegularExpressions.MatchCollection.CopyTo()
Copies all the elements of the collection to the given array starting at the given index.
Parameters
| Name | Description | Default |
|---|---|---|
array |
The array the collection is to be copied into. | |
arrayIndex |
The position in the array where copying is to begin. |
System.Text.RegularExpressions.MatchCollection.CopyTo()
Copies the elements of the collection to an System.Array, starting at a particular System.Array index.
Parameters
| Name | Description | Default |
|---|---|---|
array |
The one-dimensional System.Array that is the destination of the elements copied from the collection. The System.Array must have zero-based indexing. | |
arrayIndex |
The zero-based index in array at which copying begins. |
System.Text.RegularExpressions.MatchCollection.GetEnumerator
Provides an enumerator that iterates through the collection.
Returns
An object that contains all System.Text.RegularExpressions.Match objects within the System.Text.RegularExpressions.MatchCollection.
System.Text.RegularExpressions.MatchCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Match}#Add()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The object to add to the collection. |
System.Text.RegularExpressions.MatchCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Match}#Clear
Calling this method always throws System.NotSupportedException.
System.Text.RegularExpressions.MatchCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Match}#Contains()
Determines whether the collection contains a specific value.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The object to locate in the collection. |
Returns
System.Text.RegularExpressions.MatchCollection.System#Collections#Generic#ICollection{System#Text#RegularExpressions#Match}#Remove()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The object to remove from the collection. |
Returns
System.Text.RegularExpressions.MatchCollection.System#Collections#Generic#IEnumerable{System#Text#RegularExpressions#Match}#GetEnumerator
Returns an enumerator that iterates through the collection.
Returns
An enumerator that can be used to iterate through the collection.
System.Text.RegularExpressions.MatchCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Match}#IndexOf()
Determines the index of a specific item in the collection.
Parameters
| Name | Description | Default |
|---|---|---|
item |
The object to locate in the collection. |
Returns
The index of item if found in the list; otherwise, -1.
System.Text.RegularExpressions.MatchCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Match}#Insert()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index at which item should be inserted. | |
item |
The object to insert into the collection. |
System.Text.RegularExpressions.MatchCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Match}#RemoveAt()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index of the item to remove. |
System.Text.RegularExpressions.MatchCollection.System#Collections#IList#Add()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The object to add to the collection. |
Returns
Calling this method always throws System.NotSupportedException.
System.Text.RegularExpressions.MatchCollection.System#Collections#IList#Clear
Removes all items from the collection.
System.Text.RegularExpressions.MatchCollection.System#Collections#IList#Contains()
Determines whether the collection contains a specific value.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The object to locate in the collection. |
Returns
System.Text.RegularExpressions.MatchCollection.System#Collections#IList#IndexOf()
Determines the index of a specific item in the collection.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The object to locate in the collection. |
Returns
The index of value if found in the list; otherwise, -1.
System.Text.RegularExpressions.MatchCollection.System#Collections#IList#Insert()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index at which value should be inserted. | |
value |
The object to insert into the collection. |
System.Text.RegularExpressions.MatchCollection.System#Collections#IList#Remove()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
value |
The object to remove from the collection. |
System.Text.RegularExpressions.MatchCollection.System#Collections#IList#RemoveAt()
Calling this method always throws System.NotSupportedException.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index of the item to remove. |
System.Text.RegularExpressions.MatchCollection.Count
Gets the number of matches.
Returns
The number of matches.
System.Text.RegularExpressions.MatchCollection.IsReadOnly
Gets a value that indicates whether the collection is read only.
Returns
true in all cases.
System.Text.RegularExpressions.MatchCollection.IsSynchronized
Gets a value indicating whether access to the collection is synchronized (thread-safe).
Returns
false in all cases.
System.Text.RegularExpressions.MatchCollection.Item()
Gets an individual member of the collection.
Parameters
| Name | Description | Default |
|---|---|---|
i |
Index into the System.Text.RegularExpressions.Match collection. |
Returns
The captured substring at position i in the collection.
System.Text.RegularExpressions.MatchCollection.SyncRoot
Gets an object that can be used to synchronize access to the collection.
Returns
An object that can be used to synchronize access to the collection. This property always returns the object itself.
System.Text.RegularExpressions.MatchCollection.System#Collections#Generic#IList{System#Text#RegularExpressions#Match}#Item()
Gets the element at the specified index.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index of the element to get. |
Returns
The element at the specified index.
System.Text.RegularExpressions.MatchCollection.System#Collections#IList#IsFixedSize
Gets a value indicating whether the collection has a fixed size.
Returns
true.
System.Text.RegularExpressions.MatchCollection.System#Collections#IList#Item()
Gets the element at the specified index.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The zero-based index of the element to get. |
Returns
The element at the specified index.
System.Text.RegularExpressions.MatchEvaluator
Represents the method that is called each time a regular expression match is found during a System.Text.RegularExpressions.Regex.Replace method operation.
Parameters
| Name | Description | Default |
|---|---|---|
match |
The System.Text.RegularExpressions.Match object that represents a single regular expression match during a System.Text.RegularExpressions.Regex.Replace method operation. |
Returns
A string returned by the method that is represented by the System.Text.RegularExpressions.MatchEvaluator delegate.
System.Text.RegularExpressions.Regex
Represents an immutable regular expression.
System.Text.RegularExpressions.Regex.capnames
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.Regex.caps
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.Regex.capsize
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.Regex.capslist
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.Regex.factory
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.Regex.InfiniteMatchTimeout
Specifies that a pattern-matching operation should not time out.
System.Text.RegularExpressions.Regex.internalMatchTimeout
The maximum amount of time that can elapse in a pattern-matching operation before the operation times out.
System.Text.RegularExpressions.Regex.pattern
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.Regex.roptions
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.Regex.#ctor
Initializes a new instance of the System.Text.RegularExpressions.Regex class.
System.Text.RegularExpressions.Regex.#ctor()
Initializes a new instance of the System.Text.RegularExpressions.Regex class by using serialized data.
Parameters
| Name | Description | Default |
|---|---|---|
info |
The object that contains a serialized pattern and System.Text.RegularExpressions.RegexOptions information. | |
context |
The destination for this serialization. (This parameter is not used; specify null.) |
System.Text.RegularExpressions.Regex.#ctor()
Initializes a new instance of the System.Text.RegularExpressions.Regex class for the specified regular expression.
Parameters
| Name | Description | Default |
|---|---|---|
pattern |
The regular expression pattern to match. |
System.Text.RegularExpressions.Regex.#ctor()
Initializes a new instance of the System.Text.RegularExpressions.Regex class for the specified regular expression, with options that modify the pattern.
Parameters
| Name | Description | Default |
|---|---|---|
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that modify the regular expression. |
System.Text.RegularExpressions.Regex.#ctor()
Initializes a new instance of the System.Text.RegularExpressions.Regex 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.
Parameters
| Name | Description | Default |
|---|---|---|
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that modify the regular expression. | |
matchTimeout |
A time-out interval, or System.Text.RegularExpressions.Regex.InfiniteMatchTimeout to indicate that the method should not time out. |
System.Text.RegularExpressions.Regex.CompileToAssembly()
Compiles one or more specified System.Text.RegularExpressions.Regex objects to a named assembly.
Parameters
| Name | Description | Default |
|---|---|---|
regexinfos |
An array that describes the regular expressions to compile. | |
assemblyname |
The file name of the assembly. |
System.Text.RegularExpressions.Regex.CompileToAssembly()
Compiles one or more specified System.Text.RegularExpressions.Regex objects to a named assembly with the specified attributes.
Parameters
| Name | Description | Default |
|---|---|---|
regexinfos |
An array that describes the regular expressions to compile. | |
assemblyname |
The file name of the assembly. | |
attributes |
An array that defines the attributes to apply to the assembly. |
System.Text.RegularExpressions.Regex.CompileToAssembly()
Compiles one or more specified System.Text.RegularExpressions.Regex objects and a specified resource file to a named assembly with the specified attributes.
Parameters
| Name | Description | Default |
|---|---|---|
regexinfos |
An array that describes the regular expressions to compile. | |
assemblyname |
The file name of the assembly. | |
attributes |
An array that defines the attributes to apply to the assembly. | |
resourceFile |
The name of the Win32 resource file to include in the assembly. |
System.Text.RegularExpressions.Regex.Count()
Searches an input span for all occurrences of a regular expression and returns the number of matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The span to search for a match. |
Returns
The number of matches.
System.Text.RegularExpressions.Regex.Count()
Searches an input span for all occurrences of a regular expression and returns the number of matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The span to search for a match. | |
startat |
The zero-based character position at which to start the search. |
Returns
The number of matches.
System.Text.RegularExpressions.Regex.Count()
Searches an input span for all occurrences of a regular expression and returns the number of matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The span to search for a match. | |
pattern |
The regular expression pattern to match. |
Returns
The number of matches.
System.Text.RegularExpressions.Regex.Count()
Searches an input span for all occurrences of a regular expression and returns the number of matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The span to search for a match. | |
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that specify options for matching. |
Returns
The number of matches.
System.Text.RegularExpressions.Regex.Count()
Searches an input span for all occurrences of a regular expression and returns the number of matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The span to search for a match. | |
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that specify options for matching. | |
matchTimeout |
A time-out interval, or System.Text.RegularExpressions.Regex.InfiniteMatchTimeout to indicate that the method should not time out. |
Returns
The number of matches.
System.Text.RegularExpressions.Regex.Count()
Searches an input string for all occurrences of a regular expression and returns the number of matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The string to search for a match. |
Returns
The number of matches.
System.Text.RegularExpressions.Regex.Count()
Searches an input string for all occurrences of a regular expression and returns the number of matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The string to search for a match. | |
pattern |
The regular expression pattern to match. |
Returns
The number of matches.
System.Text.RegularExpressions.Regex.Count()
Searches an input string for all occurrences of a regular expression and returns the number of matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The string to search for a match. | |
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that specify options for matching. |
Returns
The number of matches.
System.Text.RegularExpressions.Regex.Count()
Searches an input string for all occurrences of a regular expression and returns the number of matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The string to search for a match. | |
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that specify options for matching. | |
matchTimeout |
A time-out interval, or System.Text.RegularExpressions.Regex.InfiniteMatchTimeout to indicate that the method should not time out. |
Returns
The number of matches.
System.Text.RegularExpressions.Regex.EnumerateMatches()
Searches an input span for all occurrences of a regular expression and returns a System.Text.RegularExpressions.Regex.ValueMatchEnumerator to iterate over the matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The span to search for a match. |
Returns
A System.Text.RegularExpressions.Regex.ValueMatchEnumerator to iterate over the matches.
System.Text.RegularExpressions.Regex.EnumerateMatches()
Searches an input span for all occurrences of a regular expression and returns a System.Text.RegularExpressions.Regex.ValueMatchEnumerator to iterate over the matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The span to search for a match. | |
startat |
The zero-based character position at which to start the search. |
Returns
A System.Text.RegularExpressions.Regex.ValueMatchEnumerator to iterate over the matches.
System.Text.RegularExpressions.Regex.EnumerateMatches()
Searches an input span for all occurrences of a regular expression and returns a System.Text.RegularExpressions.Regex.ValueMatchEnumerator to iterate over the matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The span to search for a match. | |
pattern |
The regular expression pattern to match. |
Returns
A System.Text.RegularExpressions.Regex.ValueMatchEnumerator to iterate over the matches.
System.Text.RegularExpressions.Regex.EnumerateMatches()
Searches an input span for all occurrences of a regular expression and returns a System.Text.RegularExpressions.Regex.ValueMatchEnumerator to iterate over the matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The span to search for a match. | |
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that specify options for matching. |
Returns
A System.Text.RegularExpressions.Regex.ValueMatchEnumerator to iterate over the matches.
System.Text.RegularExpressions.Regex.EnumerateMatches()
Searches an input span for all occurrences of a regular expression and returns a System.Text.RegularExpressions.Regex.ValueMatchEnumerator to iterate over the matches.
Parameters
| Name | Description | Default |
|---|---|---|
input |
The span to search for a match. | |
pattern |
The regular expression pattern to match. | |
options |
A bitwise combination of the enumeration values that specify options for matching. | |
matchTimeout |
A time-out interval, or System.Text.RegularExpressions.Regex.InfiniteMatchTimeout to indicate that the method should not time out. |
Returns
A System.Text.RegularExpressions.Regex.ValueMatchEnumerator to iterate over the matches.
System.Text.RegularExpressions.Regex.Escape()
转义一组最小的字符(\, *, +, ?, |, {, [, (,), ^, $, ., # 和空格),通过将它们替换为其转义代码。 这指示正则表达式引擎将这些字符字面解释,而不是作为元字符。
Parameters
| Name | Description | Default |
|---|---|---|
str |
包含要转换的文本的输入字符串。 |
转义后的字符串
一个字符字符串,其中元字符已转换为其转义形式。
System.Text.RegularExpressions.Regex.GetGroupNames
Returns an array of capturing group names for the regular expression.
Returns
A string array of group names.
System.Text.RegularExpressions.Regex.GetGroupNumbers
Returns an array of capturing group numbers that correspond to group names in an array.
Returns
An integer array of group numbers.
System.Text.RegularExpressions.Regex.GroupNameFromNumber()
Gets the group name that corresponds to the specified group number.
Parameters
| Name | Description | Default |
|---|---|---|
i |
The group number to convert to the corresponding group name. |
Returns
A string that contains the group name associated with the specified group number. If there is no group name that corresponds to i, the method returns System.String.Empty.
System.Text.RegularExpressions.Regex.GroupNumberFromName()
Returns the group number that corresponds to the specified group name.
Parameters
| Name | Description | Default |
|---|---|---|
name |
The group name to convert to the corresponding group number. |
Returns
The group number that corresponds to the specified group name, or -1 if name is not a valid group name.
System.Text.RegularExpressions.Regex.InitializeReferences
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.Regex.IsMatch()
指示在指定输入范围内,Regex构造函数中指定的正则表达式是否找到匹配项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的范围。 |
返回值
System.Text.RegularExpressions.Regex.IsMatch()
指示在指定输入范围内,Regex构造函数中指定的正则表达式是否找到匹配项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的范围。 | |
startat |
开始搜索的零基字符位置。 |
匹配结果
System.Text.RegularExpressions.Regex.IsMatch()
指示指定的正则表达式是否在指定的输入范围内找到匹配项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配的范围。 | |
pattern |
要匹配的正则表达式模式。 |
返回值
System.Text.RegularExpressions.Regex.IsMatch()
指示指定的正则表达式是否在指定的输入跨度中找到匹配项,并使用指定的匹配选项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的跨度。 | |
pattern |
要匹配的正则表达式模式。 | |
options |
提供匹配选项的枚举值的按位组合。 |
返回匹配结果
System.Text.RegularExpressions.Regex.IsMatch()
指示指定的正则表达式在指定的输入范围中是否找到匹配项,使用指定的匹配选项和超时间隔。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的范围。 | |
pattern |
要匹配的正则表达式模式。 | |
options |
提供匹配选项的枚举值的位组合。 | |
matchTimeout |
超时间隔,或System.Text.RegularExpressions.Regex.InfiniteMatchTimeout表示该方法不应超时。 |
是否匹配
System.Text.RegularExpressions.Regex.IsMatch()
指示在指定的输入字符串中,构造函数中指定的正则表达式是否找到匹配项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 |
返回匹配结果
System.Text.RegularExpressions.Regex.IsMatch()
指示在指定的输入字符串中,从指定的起始位置开始,构造函数中指定的正则表达式是否找到匹配项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
startat |
开始搜索的字符位置。 |
返回匹配结果
System.Text.RegularExpressions.Regex.IsMatch()
指示指定的正则表达式是否在指定的输入字符串中找到匹配项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 |
返回值
System.Text.RegularExpressions.Regex.IsMatch()
指示指定的正则表达式是否在指定的输入字符串中找到匹配项,并使用指定的匹配选项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
options |
提供匹配选项的枚举值的按位组合。 |
匹配结果
System.Text.RegularExpressions.Regex.IsMatch()
指示指定的正则表达式是否在指定的输入字符串中找到匹配项,使用指定的匹配选项和超时间隔。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
options |
提供匹配选项的枚举值的按位组合。 | |
matchTimeout |
超时间隔,或System.Text.RegularExpressions.Regex.InfiniteMatchTimeout表示方法不应超时。 |
返回值
System.Text.RegularExpressions.Regex.Match()
搜索指定输入字符串中指定的正则表达式的第一次出现,该正则表达式在 System.Text.RegularExpressions.Regex 构造函数中指定。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 |
匹配信息
包含有关匹配项的信息的对象。
System.Text.RegularExpressions.Regex.Match()
搜索输入字符串中正则表达式的第一次出现,从指定的起始位置开始。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
startat |
从零开始的字符位置,从该位置开始搜索。 |
匹配信息
包含有关匹配的信息的对象。
System.Text.RegularExpressions.Regex.Match()
在指定的起始位置搜索输入字符串中正则表达式的第一次出现,并仅搜索指定数量的字符。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配的字符串。 | |
beginning |
输入字符串中定义最左边搜索位置的零基字符位置。 | |
length |
要包括在搜索中的子字符串中的字符数。 |
匹配信息
一个包含匹配信息的对象。
System.Text.RegularExpressions.Regex.Match()
搜索指定的输入字符串以找到指定的正则表达式的第一次出现。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 |
匹配信息
一个包含关于匹配信息的对象。
System.Text.RegularExpressions.Regex.Match()
搜索输入字符串以查找指定正则表达式的第一次出现,使用指定的匹配选项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
options |
提供匹配选项的枚举值的按位组合。 |
返回的匹配信息
包含有关匹配的信息的对象。
System.Text.RegularExpressions.Regex.Match()
搜索输入字符串中指定正则表达式的首次出现,使用指定的匹配选项和超时间隔。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
options |
一个位组合的枚举值,提供匹配选项。 | |
matchTimeout |
超时间隔,或 System.Text.RegularExpressions.Regex.InfiniteMatchTimeout 表示该方法不应超时。 |
匹配信息
包含匹配信息的对象。
System.Text.RegularExpressions.Regex.Matches()
搜索指定输入字符串中的所有正则表达式匹配项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 |
返回匹配结果
A collection of the System.Text.RegularExpressions.Match objects found by the search. If no matches are found, the method returns an empty collection object.
System.Text.RegularExpressions.Regex.Matches()
在指定的输入字符串中搜索正则表达式的所有匹配项,从字符串中的指定起始位置开始。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
startat |
输入字符串中开始搜索的字符位置。 |
匹配项集合
一个由搜索找到的 System.Text.RegularExpressions.Match 对象组成的集合。如果未找到匹配项,则该方法返回一个空集合对象。
System.Text.RegularExpressions.Regex.Matches()
搜索指定输入字符串中的所有指定正则表达式的匹配项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配的字符串。 | |
pattern |
要匹配的正则表达式模式。 |
匹配结果集合
一个包含搜索到的 System.Text.RegularExpressions.Match 对象的集合。如果未找到任何匹配项,该方法将返回一个空集合对象。
System.Text.RegularExpressions.Regex.Matches()
在指定的输入字符串中搜索所有指定正则表达式的出现,使用指定的匹配选项。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
options |
指定匹配选项的枚举值的按位组合。 |
返回值
一个由搜索找到的 System.Text.RegularExpressions.Match 对象组成的集合。如果未找到匹配,则该方法返回一个空集合对象。
System.Text.RegularExpressions.Regex.Matches()
搜索指定输入字符串中所有的指定正则表达式的出现,使用指定的匹配选项和超时间隔。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
options |
指定匹配选项的枚举值的按位组合。 | |
matchTimeout |
超时间隔,或 System.Text.RegularExpressions.Regex.InfiniteMatchTimeout 表示该方法不应超时。 |
返回的集合
一个包含搜索中找到的 System.Text.RegularExpressions.Match 对象的集合。如果未找到匹配项,则该方法返回一个空集合对象。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入字符串中,替换所有与正则表达式模式匹配的字符串为指定的替换字符串。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
replacement |
替换字符串。 |
返回字符串
一个新的字符串,与输入字符串相同,但替换字符串替换了每个匹配的字符串。如果当前实例中没有匹配到正则表达式模式,则该方法返回当前实例而不做更改。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入字符串中,将与正则表达式模式匹配的指定最大数量的字符串替换为指定的替换字符串。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
replacement |
替换字符串。 | |
count |
替换可以发生的最大次数。 |
返回的新字符串
一个新的字符串,内容与输入字符串相同,只是替换字符串取代了每个匹配的字符串。如果正则表达式模式在当前实例中未匹配,则该方法返回当前实例,不作更改。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入子字符串中,用指定的替换字符串替换匹配正则表达式模式的指定最大数量的字符串。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要查找匹配的字符串。 | |
replacement |
替换字符串。 | |
count |
最大替换次数。 | |
startat |
输入字符串中开始查找的字符位置。 |
新字符串
返回一个与输入字符串相同的新字符串,除了替换字符串替代每个匹配的字符串。如果当前实例中未匹配正则表达式模式,则该方法返回当前实例,未更改。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入字符串中,将所有与指定的正则表达式匹配的字符串替换为指定的替换字符串。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
replacement |
替换字符串。 |
新的字符串
一个新的字符串,与输入字符串相同,除了替换字符串替代了每个匹配的字符串。如果pattern在当前实例中没有匹配,方法返回当前实例不变。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入字符串中,用指定的替换字符串替换所有匹配指定正则表达式的字符串。指定的选项修改匹配操作。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
replacement |
替换字符串。 | |
options |
提供匹配选项的枚举值的按位组合。 |
返回字符串
一个与输入字符串相同的新字符串,除了替换字符串替换了每个匹配的字符串。如果 pattern 在当前实例中未匹配,则该方法返回当前实例,不做更改。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入字符串中,将所有匹配特定正则表达式的字符串替换为指定的替换字符串。附加参数指定修改匹配操作的选项和如果没有找到匹配项的超时间隔。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
replacement |
替换字符串。 | |
options |
提供匹配选项的位组合枚举值。 | |
matchTimeout |
超时间隔,或System.Text.RegularExpressions.Regex.InfiniteMatchTimeout表示该方法不应超时。 |
新的字符串
新字符串与输入字符串相同,除了替换字符串取代每个匹配的字符串。如果pattern在当前实例中没有匹配,则方法返回当前实例不变。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入字符串中,用由 System.Text.RegularExpressions.MatchEvaluator 委托返回的字符串替换所有与指定正则表达式匹配的字符串。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
evaluator |
一个自定义方法,检查每个匹配项并返回原始匹配字符串或替换字符串。 |
新的字符串
一个新字符串,与输入字符串相同,只是每个匹配的字符串被替换字符串所替代。如果 pattern 在当前实例中未匹配,该方法将返回当前实例,保持不变。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入字符串中,用由 System.Text.RegularExpressions.MatchEvaluator 委托返回的字符串替换所有匹配指定正则表达式的字符串。指定的选项修改匹配操作。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
evaluator |
检查每个匹配项并返回原始匹配字符串或替换字符串的自定义方法。 | |
options |
提供匹配选项的枚举值的按位组合。 |
返回的新字符串
一个与输入字符串相同的新字符串,除了每个匹配的字符串都被替换字符串所替代。如果 pattern 在当前实例中没有匹配,则该方法返回当前实例,保持不变。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入字符串中,将所有与指定正则表达式匹配的子字符串替换为由 System.Text.RegularExpressions.MatchEvaluator 委托返回的字符串。其他参数指定修改匹配操作的选项以及在未找到匹配时的超时间隔。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
evaluator |
一个自定义方法,该方法检查每个匹配项并返回原始匹配字符串或替换字符串。 | |
options |
提供匹配选项的枚举值的逐位组合。 | |
matchTimeout |
一个超时间隔,或 System.Text.RegularExpressions.Regex.InfiniteMatchTimeout,表示该方法不应超时。 |
返回的新字符串
一个与输入字符串相同的新字符串,除了替换字符串取代了每个匹配的字符串。如果 pattern 在当前实例中未匹配,则该方法返回当前实例,且未改变。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入字符串中,用由 System.Text.RegularExpressions.MatchEvaluator 委托返回的字符串替换所有与指定正则表达式匹配的字符串。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
evaluator |
一个自定义方法,用于检查每个匹配项并返回原始匹配字符串或替换字符串。 |
返回的新字符串
一个与输入字符串相同的新字符串,只是每个匹配字符串被替换字符串替代。如果当前实例中未匹配正则表达式模式,则该方法返回当前实例而不做更改。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入字符串中,用由 System.Text.RegularExpressions.MatchEvaluator 委托返回的字符串替换匹配正则表达式模式的指定最大数量的字符串。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配的字符串。 | |
evaluator |
检查每个匹配并返回原始匹配字符串或替换字符串的自定义方法。 | |
count |
替换发生的最大次数。 |
返回的新字符串
一个与输入字符串完全相同的新字符串,除了每个匹配的字符串被替换字符串取代。如果在当前实例中未匹配正则表达式模式,该方法将返回当前实例,保持不变。
System.Text.RegularExpressions.Regex.Replace()
在指定的输入子字符串中,将与正则表达式模式匹配的指定最大数量的字符串替换为由System.Text.RegularExpressions.MatchEvaluator委托返回的字符串。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要搜索匹配项的字符串。 | |
evaluator |
一个自定义方法,用于检查每个匹配并返回原始匹配字符串或替代字符串。 | |
count |
替换将发生的最大次数。 | |
startat |
输入字符串中开始搜索的字符位置。 |
返回的新字符串
一个新的字符串,它与输入字符串相同,除了替换字符串取代了每个匹配的字符串。如果在当前实例中未匹配正则表达式模式,则该方法返回当前实例,未做更改。
System.Text.RegularExpressions.Regex.Split()
将输入字符串拆分为一个字符串数组,拆分位置由在 System.Text.RegularExpressions.Regex 构造函数中指定的正则表达式模式定义。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要拆分的字符串。 |
字符串数组
一个字符串数组。
System.Text.RegularExpressions.Regex.Split()
将输入字符串分割成指定最大次数的子字符串数组,分割位置由在 System.Text.RegularExpressions.Regex 构造函数中指定的正则表达式定义。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要分割的字符串。 | |
count |
可以进行分割的最大次数。 |
字符串数组
一个字符串数组。
System.Text.RegularExpressions.Regex.Split()
按照指定的最大次数将输入字符串分割成子字符串数组,分割位置由在System.Text.RegularExpressions.Regex构造函数中指定的正则表达式定义。对正则表达式模式的搜索从输入字符串中的指定字符位置开始。
Parameters
| Name | Description | Default |
|---|---|---|
input |
The string to be split. | |
count |
The maximum number of times the split can occur. | |
startat |
The character position in the input string where the search will begin. |
字符串数组
An array of strings.
System.Text.RegularExpressions.Regex.Split()
将输入字符串拆分为数组的子字符串,拆分位置由正则表达式模式定义。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要拆分的字符串。 | |
pattern |
要匹配的正则表达式模式。 |
字符串数组
一个字符串数组。
System.Text.RegularExpressions.Regex.Split()
根据指定的正则表达式模式,将输入字符串拆分为子字符串数组。指定的选项会修改匹配操作。
Parameters
| Name | Description | Default |
|---|---|---|
input |
要拆分的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
options |
提供匹配选项的枚举值的按位组合。 |
字符串数组
一个字符串数组。
System.Text.RegularExpressions.Regex.Split()
将输入字符串按照指定的正则表达式模式的定义位置拆分为子字符串的数组。附加参数指定修改匹配操作的选项以及在未找到匹配时的超时间隔。
Parameters
| Name | Description | Default |
|---|---|---|
input |
输入的字符串。 | |
pattern |
要匹配的正则表达式模式。 | |
options |
提供匹配选项的枚举值的按位组合。 | |
matchTimeout |
一个超时间隔,或 System.Text.RegularExpressions.Regex.InfiniteMatchTimeout 表示该方法不应该超时。 |
字符串数组
返回一个字符串数组。
System.Text.RegularExpressions.Regex.System#Runtime#Serialization#ISerializable#GetObjectData()
Populates a System.Runtime.Serialization.SerializationInfo object with the data necessary to deserialize the current System.Text.RegularExpressions.Regex object.
Parameters
| Name | Description | Default |
|---|---|---|
si |
The object to populate with serialization information. | |
context |
The place to store and retrieve serialized data. This parameter is reserved for future use. |
System.Text.RegularExpressions.Regex.ToString
Returns the regular expression pattern that was passed into the Regex constructor.
Returns
The pattern parameter that was passed into the Regex constructor.
System.Text.RegularExpressions.Regex.Unescape()
转换输入字符串中的任何转义字符。
Parameters
| Name | Description | Default |
|---|---|---|
str |
包含要转换的文本的输入字符串。 |
转换后的字符串
一个字符字符串,任何转义字符已转换为其未转义的形式。
System.Text.RegularExpressions.Regex.UseOptionC
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Returns
true if the System.Text.RegularExpressions.Regex.Options property contains the System.Text.RegularExpressions.RegexOptions.Compiled option; otherwise, false.
System.Text.RegularExpressions.Regex.UseOptionR
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Returns
true if the System.Text.RegularExpressions.Regex.Options property contains the System.Text.RegularExpressions.RegexOptions.RightToLeft option; otherwise, false.
System.Text.RegularExpressions.Regex.ValidateMatchTimeout()
Checks whether a time-out interval is within an acceptable range.
Parameters
| Name | Description | Default |
|---|---|---|
matchTimeout |
The time-out interval to check. |
System.Text.RegularExpressions.Regex.CacheSize
Gets or sets the maximum number of entries in the current static cache of compiled regular expressions.
Returns
The maximum number of entries in the static cache.
System.Text.RegularExpressions.Regex.CapNames
Gets or sets a dictionary that maps named capturing groups to their index values.
Returns
A dictionary that maps named capturing groups to their index values.
System.Text.RegularExpressions.Regex.Caps
Gets or sets a dictionary that maps numbered capturing groups to their index values.
Returns
A dictionary that maps numbered capturing groups to their index values.
System.Text.RegularExpressions.Regex.MatchTimeout
Gets the time-out interval of the current instance.
Returns
The maximum time interval that can elapse in a pattern-matching operation before a System.Text.RegularExpressions.RegexMatchTimeoutException is thrown, or System.Text.RegularExpressions.Regex.InfiniteMatchTimeout if time-outs are disabled.
System.Text.RegularExpressions.Regex.Options
Gets the options that were passed into the System.Text.RegularExpressions.Regex constructor.
Returns
One or more members of the System.Text.RegularExpressions.RegexOptions enumeration that represent options that were passed to the System.Text.RegularExpressions.Regex constructor.
System.Text.RegularExpressions.Regex.RightToLeft
Gets a value that indicates whether the regular expression searches from right to left.
Returns
System.Text.RegularExpressions.Regex.ValueMatchEnumerator
Represents an enumerator containing the set of successful matches found by iteratively applying a regular expression pattern to the input span.
System.Text.RegularExpressions.Regex.ValueMatchEnumerator.GetEnumerator
Provides an enumerator that iterates through the matches in the input span.
Returns
A copy of this enumerator.
System.Text.RegularExpressions.Regex.ValueMatchEnumerator.MoveNext
Advances the enumerator to the next match in the span.
Returns
System.Text.RegularExpressions.Regex.ValueMatchEnumerator.Current
Gets the System.Text.RegularExpressions.ValueMatch element at the current position of the enumerator.
System.Text.RegularExpressions.RegexCompilationInfo
Provides information about a regular expression that is used to compile a regular expression to a stand-alone assembly.
System.Text.RegularExpressions.RegexCompilationInfo.#ctor()
Initializes a new instance of the System.Text.RegularExpressions.RegexCompilationInfo class that contains information about a regular expression to be included in an assembly.
Parameters
| Name | Description | Default |
|---|---|---|
pattern |
The regular expression to compile. | |
options |
The regular expression options to use when compiling the regular expression. | |
name |
The name of the type that represents the compiled regular expression. | |
fullnamespace |
The namespace to which the new type belongs. | |
ispublic |
true to make the compiled regular expression publicly visible; otherwise, false. |
System.Text.RegularExpressions.RegexCompilationInfo.#ctor()
Initializes a new instance of the System.Text.RegularExpressions.RegexCompilationInfo class that contains information about a regular expression with a specified time-out value to be included in an assembly.
Parameters
| Name | Description | Default |
|---|---|---|
pattern |
The regular expression to compile. | |
options |
The regular expression options to use when compiling the regular expression. | |
name |
The name of the type that represents the compiled regular expression. | |
fullnamespace |
The namespace to which the new type belongs. | |
ispublic |
true to make the compiled regular expression publicly visible; otherwise, false. | |
matchTimeout |
The default time-out interval for the regular expression. |
System.Text.RegularExpressions.RegexCompilationInfo.IsPublic
Gets or sets a value that indicates whether the compiled regular expression has public visibility.
Returns
System.Text.RegularExpressions.RegexCompilationInfo.MatchTimeout
Gets or sets the regular expression's default time-out interval.
Returns
The default maximum time interval that can elapse in a pattern-matching operation before a System.Text.RegularExpressions.RegexMatchTimeoutException is thrown, or System.Text.RegularExpressions.Regex.InfiniteMatchTimeout if time-outs are disabled.
System.Text.RegularExpressions.RegexCompilationInfo.Name
Gets or sets the name of the type that represents the compiled regular expression.
Returns
The name of the new type.
System.Text.RegularExpressions.RegexCompilationInfo.Namespace
Gets or sets the namespace to which the new type belongs.
Returns
The namespace of the new type.
System.Text.RegularExpressions.RegexCompilationInfo.Options
Gets or sets the options to use when compiling the regular expression.
Returns
A bitwise combination of the enumeration values.
System.Text.RegularExpressions.RegexCompilationInfo.Pattern
Gets or sets the regular expression to compile.
Returns
The regular expression to compile.
System.Text.RegularExpressions.RegexMatchTimeoutException
The exception that is thrown when the execution time of a regular expression pattern-matching method exceeds its time-out interval.
System.Text.RegularExpressions.RegexMatchTimeoutException.#ctor
Initializes a new instance of the System.Text.RegularExpressions.RegexMatchTimeoutException class with a system-supplied message.
System.Text.RegularExpressions.RegexMatchTimeoutException.#ctor()
Initializes a new instance of the System.Text.RegularExpressions.RegexMatchTimeoutException class with serialized data.
Parameters
| Name | Description | Default |
|---|---|---|
info |
The object that contains the serialized data. | |
context |
The stream that contains the serialized data. |
System.Text.RegularExpressions.RegexMatchTimeoutException.#ctor()
Initializes a new instance of the System.Text.RegularExpressions.RegexMatchTimeoutException class with the specified message string.
Parameters
| Name | Description | Default |
|---|---|---|
message |
A string that describes the exception. |
System.Text.RegularExpressions.RegexMatchTimeoutException.#ctor()
Initializes a new instance of the System.Text.RegularExpressions.RegexMatchTimeoutException class with a specified error message and a reference to the inner exception that is the cause of this exception.
Parameters
| Name | Description | Default |
|---|---|---|
message |
A string that describes the exception. | |
inner |
The exception that is the cause of the current exception. |
System.Text.RegularExpressions.RegexMatchTimeoutException.#ctor()
Initializes a new instance of the System.Text.RegularExpressions.RegexMatchTimeoutException class with information about the regular expression pattern, the input text, and the time-out interval.
Parameters
| Name | Description | Default |
|---|---|---|
regexInput |
The input text processed by the regular expression engine when the time-out occurred. | |
regexPattern |
The pattern used by the regular expression engine when the time-out occurred. | |
matchTimeout |
The time-out interval. |
System.Text.RegularExpressions.RegexMatchTimeoutException.System#Runtime#Serialization#ISerializable#GetObjectData()
Populates a System.Runtime.Serialization.SerializationInfo object with the data needed to serialize a System.Text.RegularExpressions.RegexMatchTimeoutException object.
Parameters
| Name | Description | Default |
|---|---|---|
info |
The serialization information object to populate with data. | |
context |
The destination for this serialization. |
System.Text.RegularExpressions.RegexMatchTimeoutException.Input
Gets the input text that the regular expression engine was processing when the time-out occurred.
Returns
The regular expression input text.
System.Text.RegularExpressions.RegexMatchTimeoutException.MatchTimeout
Gets the time-out interval for a regular expression match.
Returns
The time-out interval.
System.Text.RegularExpressions.RegexMatchTimeoutException.Pattern
Gets the regular expression pattern that was used in the matching operation when the time-out occurred.
Returns
The regular expression pattern.
System.Text.RegularExpressions.RegexOptions
Provides enumerated values to use to set regular expression options.
System.Text.RegularExpressions.RegexOptions.Compiled
Specifies that the regular expression is compiled to MSIL code, instead of being interpreted. Compiled regular expressions maximize run-time performance at the expense of initialization time. This value should not be assigned to the System.Text.RegularExpressions.RegexCompilationInfo.Options property when calling the System.Text.RegularExpressions.Regex.CompileToAssembly() method. For more information, see the "Compiled Regular Expressions" section in the Regular Expression Options article.
System.Text.RegularExpressions.RegexOptions.CultureInvariant
Specifies that cultural differences in language is ignored. For more information, see the "Comparison Using the Invariant Culture" section in the Regular Expression Options article.
System.Text.RegularExpressions.RegexOptions.ECMAScript
Enables ECMAScript-compliant behavior for the expression. This value can be used only in conjunction with the System.Text.RegularExpressions.RegexOptions.IgnoreCase, System.Text.RegularExpressions.RegexOptions.Multiline, and System.Text.RegularExpressions.RegexOptions.Compiled values. The use of this value with any other values results in an exception.
For more information on the System.Text.RegularExpressions.RegexOptions.ECMAScript option, see the "ECMAScript Matching Behavior" section in the Regular Expression Options article.
System.Text.RegularExpressions.RegexOptions.ExplicitCapture
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 article.
System.Text.RegularExpressions.RegexOptions.IgnoreCase
Specifies case-insensitive matching. For more information, see the "Case-Insensitive Matching " section in the Regular Expression Options article.
System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace
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 article.
System.Text.RegularExpressions.RegexOptions.Multiline
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 article.
System.Text.RegularExpressions.RegexOptions.NonBacktracking
Enable matching using an approach that avoids backtracking and guarantees linear-time processing in the length of the input.
System.Text.RegularExpressions.RegexOptions.None
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 article.
System.Text.RegularExpressions.RegexOptions.RightToLeft
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 article.
System.Text.RegularExpressions.RegexOptions.Singleline
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 article.
System.Text.RegularExpressions.RegexParseError
Specifies the detailed underlying reason why a System.Text.RegularExpressions.RegexParseException is thrown when a regular expression contains a parsing error.
System.Text.RegularExpressions.RegexParseError.AlternationHasComment
An alternation construct in a regular expression contains a comment.
System.Text.RegularExpressions.RegexParseError.AlternationHasMalformedCondition
An alternation in a regular expression has a malformed condition.
System.Text.RegularExpressions.RegexParseError.AlternationHasMalformedReference
An alternation construct in a regular expression contains a malformed reference.
System.Text.RegularExpressions.RegexParseError.AlternationHasNamedCapture
An alternation construct in a regular expression uses a named capture.
System.Text.RegularExpressions.RegexParseError.AlternationHasTooManyConditions
An alternation in a regular expression has too many conditions.
System.Text.RegularExpressions.RegexParseError.AlternationHasUndefinedReference
An alternation construct in a regular expression contains an undefined reference.
System.Text.RegularExpressions.RegexParseError.CaptureGroupNameInvalid
The group name of a captured group in a regular expression is invalid.
System.Text.RegularExpressions.RegexParseError.CaptureGroupOfZero
A regular expression defines a numbered subexpression named zero.
System.Text.RegularExpressions.RegexParseError.ExclusionGroupNotLast
A character class in a regular expression with an exclusion group is not the last part of the character class.
System.Text.RegularExpressions.RegexParseError.InsufficientClosingParentheses
A regular expression has a non-escaped left parenthesis, or misses a closing right parenthesis.
System.Text.RegularExpressions.RegexParseError.InsufficientOpeningParentheses
A regular expression has a non-escaped right parenthesis, or misses an opening left parenthesis.
System.Text.RegularExpressions.RegexParseError.InsufficientOrInvalidHexDigits
A hexadecimal escape sequence in a regular expression does not have enough digits, or contains invalid digits.
System.Text.RegularExpressions.RegexParseError.InvalidGroupingConstruct
A grouping construct in a regular expression is invalid or malformed.
System.Text.RegularExpressions.RegexParseError.InvalidUnicodePropertyEscape
A Unicode property escape in a regular expression is invalid or unknown.
System.Text.RegularExpressions.RegexParseError.MalformedNamedReference
A named reference in a regular expression is malformed.
System.Text.RegularExpressions.RegexParseError.MalformedUnicodePropertyEscape
A Unicode property escape is malformed.
System.Text.RegularExpressions.RegexParseError.MissingControlCharacter
A control character in a regular expression is missing.
System.Text.RegularExpressions.RegexParseError.NestedQuantifiersNotParenthesized
Repeated quantifiers on another quantifier inside a regular expression are not grouped in parentheses.
System.Text.RegularExpressions.RegexParseError.QuantifierAfterNothing
A quantifier in a regular expression is in a position where it cannot quantify anything, like at the beginning of a regular expression or in a group.
System.Text.RegularExpressions.RegexParseError.QuantifierOrCaptureGroupOutOfRange
A captured group or a quantifier in a regular expression is not within range, that is, it is larger than Int32.MaxValue.
System.Text.RegularExpressions.RegexParseError.ReversedCharacterRange
A character class in a regular expression contains an inverse character range, like z-a instead of a-z.
System.Text.RegularExpressions.RegexParseError.ReversedQuantifierRange
A quantifier range in a regular expression is inverse, like
{10,1} instead of (1,10}.
System.Text.RegularExpressions.RegexParseError.ShorthandClassInCharacterRange
A character-class in a regular expression contains a short-hand class that is not allowed inside a character class.
System.Text.RegularExpressions.RegexParseError.UndefinedNamedReference
A used named reference in a regular expression is not defined.
System.Text.RegularExpressions.RegexParseError.UndefinedNumberedReference
A used numbered reference in a regular expression is not defined.
System.Text.RegularExpressions.RegexParseError.UnescapedEndingBackslash
A regular expression ends with a non-escaped ending backslash.
System.Text.RegularExpressions.RegexParseError.Unknown
An unknown regular expression parse error.
System.Text.RegularExpressions.RegexParseError.UnrecognizedControlCharacter
A control character in a regular expression is not recognized.
System.Text.RegularExpressions.RegexParseError.UnrecognizedEscape
An escape character or sequence in a regular expression is invalid.
System.Text.RegularExpressions.RegexParseError.UnrecognizedUnicodeProperty
A unicode property in a regular expression is not recognized, or invalid.
System.Text.RegularExpressions.RegexParseError.UnterminatedBracket
A regular expression has a non-escaped left square bracket, or misses a closing right square bracket.
System.Text.RegularExpressions.RegexParseError.UnterminatedComment
A comment in a regular expression is not terminated.
System.Text.RegularExpressions.RegexParseException
An exception as a result of a parse error in a regular expression, with detailed information in the System.Text.RegularExpressions.RegexParseException.Error and System.Text.RegularExpressions.RegexParseException.Offset properties.
System.Text.RegularExpressions.RegexParseException.GetObjectData()
Sets the info object with the parameter name and additional exception information.
Parameters
| Name | Description | Default |
|---|---|---|
info |
The object that holds the serialized object data. | |
context |
The contextual information about the source or destination. |
System.Text.RegularExpressions.RegexParseException.Error
Gets the error that happened during parsing.
Returns
The error that occured during parsing.
System.Text.RegularExpressions.RegexParseException.Offset
Gets the zero-based character offset in the regular expression pattern where the parse error occurs.
Returns
The offset at which the parse error occurs.
System.Text.RegularExpressions.RegexRunner
The System.Text.RegularExpressions.RegexRunner class is the base class for compiled regular expressions.
System.Text.RegularExpressions.RegexRunner.runcrawl
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runcrawlpos
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runmatch
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runregex
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runstack
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runstackpos
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runtext
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runtextbeg
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runtextend
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runtextpos
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runtextstart
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runtrack
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runtrackcount
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.runtrackpos
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.#ctor
Initializes a new instance of the System.Text.RegularExpressions.RegexRunner class.
System.Text.RegularExpressions.RegexRunner.Capture()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Parameters
| Name | Description | Default |
|---|---|---|
capnum |
A capture number. | |
start |
The starting position of the capture. | |
end |
The ending position of the capture. |
System.Text.RegularExpressions.RegexRunner.CharInClass()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method. Determines whether a character is in a character class.
Parameters
| Name | Description | Default |
|---|---|---|
ch |
A character to test. | |
charClass |
The internal name of a character class. |
Returns
true if the ch parameter is in the character class specified by the charClass parameter.
System.Text.RegularExpressions.RegexRunner.CharInSet()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Parameters
| Name | Description | Default |
|---|---|---|
ch |
A character. | |
set |
The character set. | |
category |
The character category. |
Returns
Returns System.Boolean.
System.Text.RegularExpressions.RegexRunner.CheckTimeout
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.Crawl()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Parameters
| Name | Description | Default |
|---|---|---|
i |
A number to save. |
System.Text.RegularExpressions.RegexRunner.Crawlpos
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Returns
Returns System.Int32.
System.Text.RegularExpressions.RegexRunner.DoubleCrawl
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.DoubleStack
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.DoubleTrack
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.EnsureStorage
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.FindFirstChar
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Returns
Returns System.Boolean.
System.Text.RegularExpressions.RegexRunner.Go
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.InitTrackCount
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunner.IsBoundary()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The possible boundary position. | |
startpos |
The starting position. | |
endpos |
The ending position. |
Returns
Returns System.Boolean.
System.Text.RegularExpressions.RegexRunner.IsECMABoundary()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Parameters
| Name | Description | Default |
|---|---|---|
index |
The possible ECMA boundary position. | |
startpos |
The starting position. | |
endpos |
The ending position. |
Returns
Returns System.Boolean.
System.Text.RegularExpressions.RegexRunner.IsMatched()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Parameters
| Name | Description | Default |
|---|---|---|
cap |
The capture number. |
Returns
Returns System.Boolean.
System.Text.RegularExpressions.RegexRunner.MatchIndex()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Parameters
| Name | Description | Default |
|---|---|---|
cap |
The capture number. |
Returns
Returns System.Int32.
System.Text.RegularExpressions.RegexRunner.MatchLength()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Parameters
| Name | Description | Default |
|---|---|---|
cap |
The capture number. |
Returns
Returns System.Int32.
System.Text.RegularExpressions.RegexRunner.Popcrawl
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Returns
Returns System.Int32.
System.Text.RegularExpressions.RegexRunner.Scan()
Used by a System.Text.RegularExpressions.Regex object to scan the input text looking for the next match.
Parameters
| Name | Description | Default |
|---|---|---|
text |
The text to scan for a pattern match. |
System.Text.RegularExpressions.RegexRunner.Scan()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Parameters
| Name | Description | Default |
|---|---|---|
regex |
An instance of the regular expression engine. | |
text |
The text to scan for a pattern match. | |
textbeg |
The zero-based starting position in text at which the regular expression engine scans for a match. | |
textend |
The zero-based ending position in text at which the regular expression engine scans for a match. | |
textstart |
The zero-based starting position to scan for this match. | |
prevlen |
The number of characters in the previous match. | |
quick |
true to search for a match in quick mode; otherwise, false. |
Returns
A match.
System.Text.RegularExpressions.RegexRunner.Scan()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Parameters
| Name | Description | Default |
|---|---|---|
regex |
An instance of the regular expression engine. | |
text |
The text to scan for a pattern match. | |
textbeg |
The zero-based starting position in text at which the regular expression engine scans for a match. | |
textend |
The zero-based ending position in text at which the regular expression engine scans for a match. | |
textstart |
The zero-based starting position to scan for this match. | |
prevlen |
The number of characters in the previous match. | |
quick |
true to search for a match in quick mode; otherwise, false. | |
timeout |
The timeout interval. |
Returns
A match.
System.Text.RegularExpressions.RegexRunner.TransferCapture()
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
Parameters
| Name | Description | Default |
|---|---|---|
capnum |
A capture number. | |
uncapnum |
A saved capture number. | |
start |
The starting position. | |
end |
The ending position. |
System.Text.RegularExpressions.RegexRunner.Uncapture
Used by a System.Text.RegularExpressions.Regex object generated by the System.Text.RegularExpressions.Regex.CompileToAssembly method.
System.Text.RegularExpressions.RegexRunnerFactory
Creates a System.Text.RegularExpressions.RegexRunner class for a compiled regular expression.
System.Text.RegularExpressions.RegexRunnerFactory.#ctor
Initializes a new instance of the System.Text.RegularExpressions.RegexRunnerFactory class.
System.Text.RegularExpressions.RegexRunnerFactory.CreateInstance
When overridden in a derived class, creates a System.Text.RegularExpressions.RegexRunner object for a specific compiled regular expression.
Returns
A System.Text.RegularExpressions.RegexRunner object designed to execute a specific compiled regular expression.
System.Text.RegularExpressions.ValueMatch
Represents the results from a single regular expression match.
System.Text.RegularExpressions.ValueMatch.Index
Gets the position in the original span where the first character of the captured sliced span is found.
System.Text.RegularExpressions.ValueMatch.Length
Gets the length of the captured sliced span.