VegaRise.NET
Back to Text

ReplaceMethod

Definition

Namespace
DOM.Elements.TextElements
Assembly
DOM.dll

Replaces occurrences of the specified search text within the current text content. Supports optional regular expression behavior, whole-word matching, and case-sensitivity controls.

IText Replace(string searchText, string replaceText, RegexOptions? regexOption, bool wholeWordOnly, bool caseSensitive)

Parameters

searchText
The text to search for. Cannot be null.
replaceText
The replacement text to substitute in matched positions.
regexOption
Optional to apply. RegexOptions
wholeWordOnly
When, the match must correspond to a complete whole word boundary.
caseSensitive
When, the search is case-sensitive; otherwise performed case-insensitively.

Returns

IText

Returns the current instance to allow fluent chaining. IText

Exceptions

  • System.ArgumentNullException: Thrown when is null. searchText

Remarks

When is, word boundaries (\b) are added automatically around the escaped pattern. wholeWordOnly searchText true

Examples

csharp
1var t = new Text("The quick brown fox");
2t.Replace("fox", "dog", wholeWordOnly: true, caseSensitive: false);
3
VegaRiseVDocs.NET

Reset Password

Enter your email and we'll send you a link to reset your password.

Remember your password? Sign in