MetadataSearchRedaction class

MetadataSearchRedaction class

Represents a metadata redaction that searches and redacts metadata using regular expressions, matching keys and/or values.

The MetadataSearchRedaction type exposes the following members:

Constructors

Constructor Description
init Initializes a new instance of MetadataSearchRedaction class, using value to match redacted items.
init Initializes a new instance of MetadataSearchRedaction, using item name and value to match redacted items.
init Initializes a new instance of MetadataSearchRedaction class, using value to match redacted items.
init Initializes a new instance of MetadataSearchRedaction using item name and value to match redacted items.

Methods

Method Description
apply_to Applies the redaction to a given format instance. (inherited from MetadataRedaction)
apply_to_document_format_instance (inherited from MetadataRedaction)

Properties

Property Description
description The description of the redaction, containing its name and parameters.
key_expression The regular expression to match the name (key) of a metadata item.
replacement The textual replacement value.
value_expression The regular expression to match the value text of a metadata item.
filter The filter used to select all or specific metadata, such as Author or Company. (inherited from MetadataRedaction)

Example

from groupdocs.redaction import Redactor
from groupdocs.redaction.redactions import MetadataSearchRedaction, MetadataFilters

with Redactor("document.docx") as redactor:
    # Redact any metadata value matching the pattern
    redaction = MetadataSearchRedaction("Company Ltd.", "--company--")
    redaction.filter = MetadataFilters.COMPANY
    redactor.apply(redaction)
    redactor.save()

Guides

Task guides that use MetadataSearchRedaction:

See Also