VDocs.NET
HomeAPI Reference
Back to DOM

DOM.Elements.TextElements.BaseTextElement`1

Namespace: DOM.Elements.TextElements

Base class for text-bearing elements that support search and replace operations.

Implementations should provide text searching and replacement behavior appropriate to the concrete element (for example text runs, paragraphs or other inline containers). Methods accept optional regular expression options and support common convenience flags such as whole-word matching and case sensitivity.

2 members

Methods

Find

Find(string searchText, RegexOptions? regexOption, bool wholeWordOnly, bool caseSensitive)

Finds occurrences within this element's text content.

Parameters

searchText
The text or pattern to search for. If or empty, implementations should return an empty list.
regexOption
Optional to apply when performing the search. When, implementations should use a sensible default (for example). If the is not a regular expression,may be ignored depending on the implementation.
wholeWordOnly
When, match only whole-word occurrences. Implementations should apply word-boundary semantics to avoid partial matches (for example "art" not matching "partial").
caseSensitive
When, perform a case-sensitive search; otherwise perform a case-insensitive search. This flag may be implemented by adjusting options or by normalizing text, depending on the concrete implementation.

Returns

A list of integer positions (for example character offsets or run indexes) representing the start locations of each match. The exact meaning of the returned integers is implementation-specific but should be documented by concrete implementers.

Replace

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

Replaces occurrences within this element's text content.

Parameters

searchText
The text or pattern to search for. If or empty, implementations should typically return the original element unmodified.
replaceText
The replacement text to insert for each match. May beor empty to remove matches depending on implementation.
regexOption
Optional to apply when performing the replace. When, implementations should use a sensible default. If the is not a regular expression,may be ignored depending on the implementation.
wholeWordOnly
When, replace only whole-word occurrences. Implementations should apply word-boundary semantics to avoid partial replacements.
caseSensitive
When, perform case-sensitive replacements; otherwise perform case-insensitive replacements.

Returns

An instance ofrepresenting the element after performing replacements. Implementations may return the same instance (mutating) or a new instance (immutable-style).