ExactPhraseRedaction class

ExactPhraseRedaction class

Represents a text redaction that replaces an exact phrase in the document’s text, case insensitive by default.

Learn more:

The ExactPhraseRedaction type exposes the following members:

Constructors

Constructor Description
init Initializes a new instance of ExactPhraseRedaction in case‑insensitive mode.
init Initializes a new ExactPhraseRedaction instance.

Methods

Method Description
apply_to Applies the redaction to a given format instance.
apply_to_document_format_instance

Properties

Property Description
description The description of the redaction, containing the redaction name and parameters.
is_case_sensitive The value indicating whether the search is case-sensitive.
is_right_to_left The text direction flag indicating whether the text is right‑to‑left. Defaults to False.
search_phrase The string to search and replace.
action_options The ReplacementOptions instance specifying the type of text replacement. (inherited from TextRedaction)
ocr_connector The IOcrConnector implementation used to extract text from graphic content. (inherited from TextRedaction)

Example

from groupdocs.redaction import Redactor
from groupdocs.redaction.redactions import ExactPhraseRedaction, ReplacementOptions

with Redactor("sample.pdf") as redactor:
    # case‑sensitive replacement
    redactor.apply(ExactPhraseRedaction("John Doe", True, ReplacementOptions("[personal]")))
    redactor.save()

Guides

Task guides that use ExactPhraseRedaction:

See Also