__init__ constructor

init

Initializes a new AnnotationRedaction with a regex pattern and replacement text.

def __init__(self, pattern, replacement):
    ...
Parameter Type Description
pattern str Regular expression to match.
replacement str Textual replacement for matched text.

Example

from groupdocs.redaction.redactions import AnnotationRedaction

# Redact the word "approved" in annotation texts
redaction = AnnotationRedaction(r"(?i)approved", "[REVIEW]")

init

Initializes a new instance of AnnotationRedaction.

def __init__(self, regex, replacement):
    ...
Parameter Type Description
regex System.Text.RegularExpressions.Regex Regular expression to match.
replacement str Textual replacement for matched text.

Example

from groupdocs.redaction.redactions import AnnotationRedaction

# Redact the word "approved" (case‑insensitive) and replace it with "[REVIEW]"
redaction = AnnotationRedaction("(?i)approved", "[REVIEW]")

See Also