Regex.Replace Method
Definition
Namespace: Corvus.Ecma262.RegularExpressions
Assembly: Corvus.Regex.Ecma262.dll
Overloads
| Method |
Description |
| Replace(string, string, string, RegexFlags) |
Replaces the matches of a pattern in a text (every match with Global, the first otherwise). |
| Replace(string, string) |
Replaces the matches in a text: every match with Global, the first otherwise, as String.prototype.replace does. The replacement... |
| Replace(string, MatchEvaluator) |
Replaces the matches in a text (every match with Global, the first otherwise) with what an evaluator gives for each, used as it is. |
| Replace(ReadOnlySpan<char>, ReadOnlySpan<char>, IBufferWriter<char>) |
Replaces the matches in a UTF-16 text and writes the result to a buffer writer, allocating nothing itself (see TryReplace). |
| Replace(ReadOnlySpan<byte>, ReadOnlySpan<byte>, IBufferWriter<byte>) |
Replaces the matches in a UTF-8 text and writes the result to a buffer writer, allocating nothing itself. |
| Replace(ReadOnlySpan<char>, SpanMatchEvaluator, IBufferWriter<char>) |
Replaces the matches in a UTF-16 text (every match with Global, the first otherwise) with what an evaluator writes for each, and w... |
| Replace(ReadOnlySpan<byte>, Utf8MatchEvaluator, IBufferWriter<byte>) |
Replaces the matches in a UTF-8 text with what an evaluator writes for each, and writes the result to a buffer writer, allocating nothing itself. |
Replace(string, string, string, RegexFlags)
Source: Regex.Matching.cs
Replaces the matches of a pattern in a text (every match with Global, the first otherwise).
public static string Replace(string input, string pattern, string replacement, RegexFlags flags)
Parameters
Returns
string
The text with the replacements made.
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |
Replace(string, string)
Source: Regex.Matching.cs
Replaces the matches in a text: every match with Global, the first otherwise, as String.prototype.replace does. The replacement is expanded as Result expands it.
public string Replace(string input, string replacement)
Parameters
| Name |
Type |
Description |
input |
string |
The text. |
replacement |
string |
The replacement. |
Returns
string
The text with the replacements made.
Exceptions
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |
Replace(string, MatchEvaluator)
Source: Regex.Matching.cs
Replaces the matches in a text (every match with Global, the first otherwise) with what an evaluator gives for each, used as it is.
public string Replace(string input, MatchEvaluator evaluator)
Parameters
Returns
string
The text with the replacements made.
Exceptions
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |
Replace(ReadOnlySpan<char>, ReadOnlySpan<char>, IBufferWriter<char>)
Source: Regex.Spans.cs
Replaces the matches in a UTF-16 text and writes the result to a buffer writer, allocating nothing itself (see TryReplace).
public void Replace(ReadOnlySpan<char> input, ReadOnlySpan<char> replacement, IBufferWriter<char> destination)
Parameters
Exceptions
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |
Replace(ReadOnlySpan<byte>, ReadOnlySpan<byte>, IBufferWriter<byte>)
Source: Regex.Spans.cs
Replaces the matches in a UTF-8 text and writes the result to a buffer writer, allocating nothing itself.
public void Replace(ReadOnlySpan<byte> utf8, ReadOnlySpan<byte> replacement, IBufferWriter<byte> destination)
Parameters
Exceptions
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |
Replace(ReadOnlySpan<char>, SpanMatchEvaluator, IBufferWriter<char>)
Source: Regex.Spans.cs
Replaces the matches in a UTF-16 text (every match with Global, the first otherwise) with what an evaluator writes for each, and writes the result to a buffer writer, allocating nothing itself.
public void Replace(ReadOnlySpan<char> input, SpanMatchEvaluator evaluator, IBufferWriter<char> destination)
Parameters
Exceptions
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |
Replace(ReadOnlySpan<byte>, Utf8MatchEvaluator, IBufferWriter<byte>)
Source: Regex.Spans.cs
Replaces the matches in a UTF-8 text with what an evaluator writes for each, and writes the result to a buffer writer, allocating nothing itself.
public void Replace(ReadOnlySpan<byte> utf8, Utf8MatchEvaluator evaluator, IBufferWriter<byte> destination)
Parameters
Exceptions
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |