Regex.Split Method
Definition
Namespace: Corvus.Ecma262.RegularExpressions
Assembly: Corvus.Regex.Ecma262.dll
Overloads
| Method | Description |
|---|---|
| Split(string, string, RegexFlags) | Splits a text at the matches of a pattern, as String.prototype.split does. |
| Split(string) | Splits a text at the matches, as String.prototype.split does: the captures of each match are put between the pieces (null for a group that did not take part), and an empty match at the start or t... |
| Split(string, int) | Splits a text at the matches, up to a number of pieces (the limit of String.prototype.split). |
Split(string, string, RegexFlags)
Source: Regex.Matching.cs
Splits a text at the matches of a pattern, as String.prototype.split does.
public static string[] Split(string input, string pattern, RegexFlags flags)
Parameters
| Name | Type | Description |
|---|---|---|
input |
string |
The text. |
pattern |
string |
The pattern. |
flags |
RegexFlags |
The flags. (optional) |
Returns
The pieces.
Applies To
| Product | Versions |
|---|---|
| .NET | 9, 10 |
| .NET Standard | 2.0, 2.1 |
Split(string)
Source: Regex.Matching.cs
Splits a text at the matches, as String.prototype.split does: the captures of each match are put between the pieces (null for a group that did not take part), and an empty match at the start or the end of the text splits nothing.
public string[] Split(string input)
Parameters
| Name | Type | Description |
|---|---|---|
input |
string |
The text. |
Returns
The pieces.
Exceptions
| Exception | Description |
|---|---|
RegexMatchTimeoutException |
A match reached its limit. |
Applies To
| Product | Versions |
|---|---|
| .NET | 9, 10 |
| .NET Standard | 2.0, 2.1 |
Split(string, int)
Source: Regex.Matching.cs
Splits a text at the matches, up to a number of pieces (the limit of String.prototype.split).
public string[] Split(string input, int count)
Parameters
| Name | Type | Description |
|---|---|---|
input |
string |
The text. |
count |
int |
The most pieces to return, captures included. 0 gives none. |
Returns
The pieces.
Exceptions
| Exception | Description |
|---|---|
RegexMatchTimeoutException |
A match reached its limit. |
Applies To
| Product | Versions |
|---|---|
| .NET | 9, 10 |
| .NET Standard | 2.0, 2.1 |
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.
Open an issue