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 class in case insensitive mode.
init Initializes a new ExactPhraseRedaction.

Methods

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

Properties

Property Description
description The description of the redaction, containing its name and parameters.
is_case_sensitive The property indicates 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 OCR connector 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 phrase replacement
    redactor.apply(ExactPhraseRedaction("Emily Johnson", True, ReplacementOptions("[personal]")))
    # Case-insensitive phrase replacement (default)
    redactor.apply(ExactPhraseRedaction("Emily Johnson", ReplacementOptions("[personal]")))
    redactor.save()

Guides

Task guides that use ExactPhraseRedaction:

See Also