Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

Regex.EnumerateSplits Method

Definition

Namespace:
System.Text.RegularExpressions
Assemblies:
netstandard.dll, System.Text.RegularExpressions.dll

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

NameDescription
EnumerateSplits(ReadOnlySpan<Char>)

Searches an input span for all occurrences of a regular expression and returns aRegex.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 aRegex.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 aRegex.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 aRegex.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 aRegex.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 aRegex.ValueSplitEnumerator to iterate over the splits around matches.

EnumerateSplits(ReadOnlySpan<Char>)

Source:
Regex.EnumerateSplits.cs
Source:
Regex.EnumerateSplits.cs

Searches an input span for all occurrences of a regular expression and returns aRegex.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

ARegex.ValueSplitEnumerator to iterate over the matches.

Remarks

The behavior ofEnumerateSplits(ReadOnlySpan<Char>) is similar to the behavior ofSplit(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, whileEnumerateSplits(ReadOnlySpan<Char>) will not. And ifRightToLeft is specified,Split(String) will reverse the order of the resulting splits to be left-to-right, whereasEnumerateSplits(ReadOnlySpan<Char>) will yield the splits in the order they're found right-to-left.

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

Applies to

EnumerateSplits(ReadOnlySpan<Char>, Int32)

Source:
Regex.EnumerateSplits.cs
Source:
Regex.EnumerateSplits.cs

Searches an input span for all occurrences of a regular expression and returns aRegex.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

ARegex.ValueSplitEnumerator to iterate over the matches.

Remarks

The behavior ofEnumerateSplits(ReadOnlySpan<Char>, Int32) is similar to the behavior ofSplit(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, whileEnumerateSplits(ReadOnlySpan<Char>, Int32) will not. And ifRightToLeft is specified,Split(String, Int32) will reverse the order of the resulting splits to be left-to-right, whereasEnumerateSplits(ReadOnlySpan<Char>, Int32) will yield the splits in the order they're found right-to-left.

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

Applies to

EnumerateSplits(ReadOnlySpan<Char>, String)

Source:
Regex.EnumerateSplits.cs
Source:
Regex.EnumerateSplits.cs

Searches an input span for all occurrences of a regular expression and returns aRegex.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

ARegex.ValueSplitEnumerator to iterate over the splits around matches.

Exceptions

pattern isnull.

A regular expression parsing error occurred.

Remarks

The behavior ofEnumerateSplits(ReadOnlySpan<Char>, String) is similar to the behavior ofSplit(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, whileEnumerateSplits(ReadOnlySpan<Char>, String) will not. And ifRightToLeft is specified,Split(String, String) will reverse the order of the resulting splits to be left-to-right, whereasEnumerateSplits(ReadOnlySpan<Char>, String) will yield the splits in the order they're found right-to-left.

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

Applies to

EnumerateSplits(ReadOnlySpan<Char>, Int32, Int32)

Source:
Regex.EnumerateSplits.cs
Source:
Regex.EnumerateSplits.cs

Searches an input span for all occurrences of a regular expression and returns aRegex.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

ARegex.ValueSplitEnumerator to iterate over the matches.

Remarks

The behavior ofEnumerateSplits(ReadOnlySpan<Char>, Int32, Int32) is similar to the behavior ofSplit(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, whileEnumerateSplits(ReadOnlySpan<Char>, Int32, Int32) will not. And ifRightToLeft is specified,Split(String, Int32, Int32) will reverse the order of the resulting splits to be left-to-right, whereasEnumerateSplits(ReadOnlySpan<Char>, Int32, Int32) will yield the splits in the order they're found right-to-left.

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

Applies to

EnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions)

Source:
Regex.EnumerateSplits.cs
Source:
Regex.EnumerateSplits.cs

Searches an input span for all occurrences of a regular expression and returns aRegex.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

ARegex.ValueSplitEnumerator to iterate over the splits around matches.

Exceptions

pattern isnull.

options is not a valid bitwise combination of RegexOptions values.

A regular expression parsing error occurred.

Remarks

The behavior ofEnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions) is similar to the behavior ofSplit(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, whileEnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions) will not. And ifRightToLeft is specified,Split(String, String, RegexOptions) will reverse the order of the resulting splits to be left-to-right, whereasEnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions) will yield the splits in the order they're found right-to-left.

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

Applies to

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

Source:
Regex.EnumerateSplits.cs
Source:
Regex.EnumerateSplits.cs

Searches an input span for all occurrences of a regular expression and returns aRegex.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, orInfiniteMatchTimeout to indicate that the method should not time out.

Returns

ARegex.ValueSplitEnumerator to iterate over the splits around matches.

Exceptions

pattern isnull.

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

A regular expression parsing error occurred.

Remarks

The behavior ofEnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions, TimeSpan) is similar to the behavior ofSplit(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, whileEnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions, TimeSpan) will not. And ifRightToLeft is specified,Split(String, String, RegexOptions, TimeSpan) will reverse the order of the resulting splits to be left-to-right, whereasEnumerateSplits(ReadOnlySpan<Char>, String, RegexOptions, TimeSpan) will yield the splits in the order they're found right-to-left.

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

Applies to

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?