Skip to content

Regex.ReplaceUnchecked Method

Definition

Namespace: Corvus.Ecma262.RegularExpressions
Assembly: Corvus.Regex.Ecma262.dll

Overloads

Method Description
ReplaceUnchecked(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.
ReplaceUnchecked(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.

ReplaceUnchecked(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 ReplaceUnchecked(ReadOnlySpan<byte> utf8, ReadOnlySpan<byte> replacement, IBufferWriter<byte> destination)

Parameters

Name Type Description
utf8 ReadOnlySpan<byte> The text.
replacement ReadOnlySpan<byte> The replacement, as UTF-8.
destination IBufferWriter<byte> Where to write the result.

Exceptions

Exception Description
RegexMatchTimeoutException A match reached its limit.

Remarks

The text is not checked to be UTF-8: this is for text its caller knows to be UTF-8, such as the strings of parsed JSON, or a text checked once and matched many times. Bytes that are not UTF-8 are read as U+FFFD one at a time; the member without Unchecked refuses them.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

ReplaceUnchecked(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 ReplaceUnchecked(ReadOnlySpan<byte> utf8, Utf8MatchEvaluator evaluator, IBufferWriter<byte> destination)

Parameters

Name Type Description
utf8 ReadOnlySpan<byte> The text.
evaluator Utf8MatchEvaluator The evaluator.
destination IBufferWriter<byte> Where to write the result.

Exceptions

Exception Description
RegexMatchTimeoutException A match reached its limit.

Remarks

The text is not checked to be UTF-8: this is for text its caller knows to be UTF-8, such as the strings of parsed JSON, or a text checked once and matched many times. Bytes that are not UTF-8 are read as U+FFFD one at a time; the member without Unchecked refuses them.

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