Bewerken

Share via


Regex.EnumerateSplits Method

Definition

Overloads

EnumerateSplits(ReadOnlySpan<Char>)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

EnumerateSplits(ReadOnlySpan<Char>, Int32)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

EnumerateSplits(ReadOnlySpan<Char>, String)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

EnumerateSplits(ReadOnlySpan<Char>, Int32, Int32)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

EnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

EnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions, TimeSpan)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

EnumerateSplits(ReadOnlySpan<Char>)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

public:
 System::Text::RegularExpressions::Regex::ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char> input);
public System.Text.RegularExpressions.Regex.ValueSplitEnumerator EnumerateSplits (ReadOnlySpan<char> input);
member this.EnumerateSplits : ReadOnlySpan<char> -> System.Text.RegularExpressions.Regex.ValueSplitEnumerator
Public Function EnumerateSplits (input As ReadOnlySpan(Of Char)) As Regex.ValueSplitEnumerator

Parameters

input
ReadOnlySpan<Char>

The span to search for a match.

Returns

A Regex.ValueSplitEnumerator to iterate over the matches.

Remarks

The behavior of EnumerateSplits(ReadOnlySpan<Char>) is similar to the behavior of Split(String), producing the splits one at a time as part of iterating through the resulting enumerator rather than all at once as part of a single array. However, there are a few notable differences. Split(String) will include the contents of capture groups in the resulting splits, while EnumerateSplits(ReadOnlySpan<Char>) will not. And if RightToLeft is specified, Split(String) will reverse the order of the resulting splits to be left-to-right, whereas EnumerateSplits(ReadOnlySpan<Char>) will yield the splits in the order they're found right-to-left.

Each match won't actually happen until MoveNext() is invoked on the enumerator, with one match being performed per MoveNext() call. Since the evaluation of the match happens lazily, any changes to the passed in input in between calls to MoveNext() may affect the match results; such changes should be avoided and are not supported.

Applies to

EnumerateSplits(ReadOnlySpan<Char>, Int32)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

public:
 System::Text::RegularExpressions::Regex::ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char> input, int count);
public System.Text.RegularExpressions.Regex.ValueSplitEnumerator EnumerateSplits (ReadOnlySpan<char> input, int count);
member this.EnumerateSplits : ReadOnlySpan<char> * int -> System.Text.RegularExpressions.Regex.ValueSplitEnumerator
Public Function EnumerateSplits (input As ReadOnlySpan(Of Char), count As Integer) As Regex.ValueSplitEnumerator

Parameters

input
ReadOnlySpan<Char>

The span to search for a match.

count
Int32

The maximum number of times the split can occur. If 0, all splits are available.

Returns

A Regex.ValueSplitEnumerator to iterate over the matches.

Remarks

The behavior of EnumerateSplits(ReadOnlySpan<Char>, Int32) is similar to the behavior of Split(String, Int32), producing the splits one at a time as part of iterating through the resulting enumerator rather than all at once as part of a single array. However, there are a few notable differences. Split(String, Int32) will include the contents of capture groups in the resulting splits, while EnumerateSplits(ReadOnlySpan<Char>, Int32) will not. And if RightToLeft is specified, Split(String, Int32) will reverse the order of the resulting splits to be left-to-right, whereas EnumerateSplits(ReadOnlySpan<Char>, Int32) will yield the splits in the order they're found right-to-left.

Each match won't actually happen until MoveNext() is invoked on the enumerator, with one match being performed per MoveNext() call. Since the evaluation of the match happens lazily, any changes to the passed in input in between calls to MoveNext() may affect the match results; such changes should be avoided and are not supported.

Applies to

EnumerateSplits(ReadOnlySpan<Char>, String)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

public:
 static System::Text::RegularExpressions::Regex::ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char> input, System::String ^ pattern);
public static System.Text.RegularExpressions.Regex.ValueSplitEnumerator EnumerateSplits (ReadOnlySpan<char> input, string pattern);
static member EnumerateSplits : ReadOnlySpan<char> * string -> System.Text.RegularExpressions.Regex.ValueSplitEnumerator
Public Shared Function EnumerateSplits (input As ReadOnlySpan(Of Char), pattern As String) As Regex.ValueSplitEnumerator

Parameters

input
ReadOnlySpan<Char>

The span to search for a match.

pattern
String

The regular expression pattern to match.

Returns

A Regex.ValueSplitEnumerator to iterate over the splits around matches.

Exceptions

pattern is null.

A regular expression parsing error occurred.

Remarks

The behavior of EnumerateSplits(ReadOnlySpan<Char>, String) is similar to the behavior of Split(String, String), producing the splits one at a time as part of iterating through the resulting enumerator rather than all at once as part of a single array. However, there are a few notable differences. Split(String, String) will include the contents of capture groups in the resulting splits, while EnumerateSplits(ReadOnlySpan<Char>, String) will not. And if RightToLeft is specified, Split(String, String) will reverse the order of the resulting splits to be left-to-right, whereas EnumerateSplits(ReadOnlySpan<Char>, String) will yield the splits in the order they're found right-to-left.

Each match won't actually happen until MoveNext() is invoked on the enumerator, with one match being performed per MoveNext() call. Since the evaluation of the match happens lazily, any changes to the passed in input in between calls to MoveNext() may affect the match results; such changes should be avoided and are not supported.

Applies to

EnumerateSplits(ReadOnlySpan<Char>, Int32, Int32)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

public:
 System::Text::RegularExpressions::Regex::ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char> input, int count, int startat);
public System.Text.RegularExpressions.Regex.ValueSplitEnumerator EnumerateSplits (ReadOnlySpan<char> input, int count, int startat);
member this.EnumerateSplits : ReadOnlySpan<char> * int * int -> System.Text.RegularExpressions.Regex.ValueSplitEnumerator
Public Function EnumerateSplits (input As ReadOnlySpan(Of Char), count As Integer, startat As Integer) As Regex.ValueSplitEnumerator

Parameters

input
ReadOnlySpan<Char>

The span to search for a match.

count
Int32

The maximum number of times the split can occur. If 0, all splits are available.

startat
Int32

The zero-based character position at which to start the search.

Returns

A Regex.ValueSplitEnumerator to iterate over the matches.

Remarks

The behavior of EnumerateSplits(ReadOnlySpan<Char>, Int32, Int32) is similar to the behavior of Split(String, Int32, Int32), producing the splits one at a time as part of iterating through the resulting enumerator rather than all at once as part of a single array. However, there are a few notable differences. Split(String, Int32, Int32) will include the contents of capture groups in the resulting splits, while EnumerateSplits(ReadOnlySpan<Char>, Int32, Int32) will not. And if RightToLeft is specified, Split(String, Int32, Int32) will reverse the order of the resulting splits to be left-to-right, whereas EnumerateSplits(ReadOnlySpan<Char>, Int32, Int32) will yield the splits in the order they're found right-to-left.

Each match won't actually happen until MoveNext() is invoked on the enumerator, with one match being performed per MoveNext() call. Since the evaluation of the match happens lazily, any changes to the passed in input in between calls to MoveNext() may affect the match results; such changes should be avoided and are not supported.

Applies to

EnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

public:
 static System::Text::RegularExpressions::Regex::ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char> input, System::String ^ pattern, System::Text::RegularExpressions::RegexOptions options);
public static System.Text.RegularExpressions.Regex.ValueSplitEnumerator EnumerateSplits (ReadOnlySpan<char> input, string pattern, System.Text.RegularExpressions.RegexOptions options);
static member EnumerateSplits : ReadOnlySpan<char> * string * System.Text.RegularExpressions.RegexOptions -> System.Text.RegularExpressions.Regex.ValueSplitEnumerator
Public Shared Function EnumerateSplits (input As ReadOnlySpan(Of Char), pattern As String, options As RegexOptions) As Regex.ValueSplitEnumerator

Parameters

input
ReadOnlySpan<Char>

The span to search for a match.

pattern
String

The regular expression pattern to match.

options
RegexOptions

A bitwise combination of the enumeration values that specify options for matching.

Returns

A Regex.ValueSplitEnumerator to iterate over the splits around matches.

Exceptions

pattern is null.

options is not a valid bitwise combination of RegexOptions values.

A regular expression parsing error occurred.

Remarks

The behavior of EnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions) is similar to the behavior of Split(String, String, RegexOptions), producing the splits one at a time as part of iterating through the resulting enumerator rather than all at once as part of a single array. However, there are a few notable differences. Split(String, String, RegexOptions) will include the contents of capture groups in the resulting splits, while EnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions) will not. And if RightToLeft is specified, Split(String, String, RegexOptions) will reverse the order of the resulting splits to be left-to-right, whereas EnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions) will yield the splits in the order they're found right-to-left.

Each match won't actually happen until MoveNext() is invoked on the enumerator, with one match being performed per MoveNext() call. Since the evaluation of the match happens lazily, any changes to the passed in input in between calls to MoveNext() may affect the match results; such changes should be avoided and are not supported.

Applies to

EnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions, TimeSpan)

Searches an input span for all occurrences of a regular expression and returns a Regex.ValueSplitEnumerator to iterate over the splits around matches.

public:
 static System::Text::RegularExpressions::Regex::ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char> input, System::String ^ pattern, System::Text::RegularExpressions::RegexOptions options, TimeSpan matchTimeout);
public static System.Text.RegularExpressions.Regex.ValueSplitEnumerator EnumerateSplits (ReadOnlySpan<char> input, string pattern, System.Text.RegularExpressions.RegexOptions options, TimeSpan matchTimeout);
static member EnumerateSplits : ReadOnlySpan<char> * string * System.Text.RegularExpressions.RegexOptions * TimeSpan -> System.Text.RegularExpressions.Regex.ValueSplitEnumerator
Public Shared Function EnumerateSplits (input As ReadOnlySpan(Of Char), pattern As String, options As RegexOptions, matchTimeout As TimeSpan) As Regex.ValueSplitEnumerator

Parameters

input
ReadOnlySpan<Char>

The span to search for a match.

pattern
String

The regular expression pattern to match.

options
RegexOptions

A bitwise combination of the enumeration values that specify options for matching.

matchTimeout
TimeSpan

A time-out interval, or InfiniteMatchTimeout to indicate that the method should not time out.

Returns

A Regex.ValueSplitEnumerator to iterate over the splits around matches.

Exceptions

pattern is null.

options is not a valid bitwise combination of RegexOptions values, or matchTimeout is negative, zero, or greater than approximately 24 days.

A regular expression parsing error occurred.

Remarks

The behavior of EnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions, TimeSpan) is similar to the behavior of Split(String, String, RegexOptions, TimeSpan), producing the splits one at a time as part of iterating through the resulting enumerator rather than all at once as part of a single array. However, there are a few notable differences. Split(String, String, RegexOptions, TimeSpan) will include the contents of capture groups in the resulting splits, while EnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions, TimeSpan) will not. And if RightToLeft is specified, Split(String, String, RegexOptions, TimeSpan) will reverse the order of the resulting splits to be left-to-right, whereas EnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions, TimeSpan) will yield the splits in the order they're found right-to-left.

Each match won't actually happen until MoveNext() is invoked on the enumerator, with one match being performed per MoveNext() call. Since the evaluation of the match happens lazily, any changes to the passed in input in between calls to MoveNext() may affect the match results; such changes should be avoided and are not supported.

Applies to