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 class, using item name and value to match redacted items.
init Initializes a new MetadataSearchRedaction that redacts document metadata matching a regular expression.
init Initializes a new instance of MetadataSearchRedaction class, 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)

Properties

Property Description
description The description of the redaction, describing the redaction and its 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

# Search for "Company Ltd." in metadata and replace it with "--company--"
redaction = MetadataSearchRedaction("Company Ltd.", "--company--")
# Apply to a specific metadata field (optional); omit to apply to all fields
redaction.filter = MetadataFilters.COMPANY

with Redactor("./sample.docx") as redactor:
    redactor.apply(redaction)
    redactor.save()

Guides

Task guides that use MetadataSearchRedaction:

See Also