Skip to main content

replace_matches

Function replace_matches 

Source
pub fn replace_matches(
    text: &str,
    thesaurus: Thesaurus,
    link_type: LinkType,
) -> Result<Vec<u8>>
Expand description

Replace matches in text using the thesaurus.

Uses display() method on NormalizedTerm to get the case-preserved display value for replacement output.

URLs (http, https, mailto, email addresses) are protected from replacement to prevent corruption of links.

Patterns shorter than MIN_PATTERN_LENGTH (2) are filtered out to prevent spurious matches at every character position.