MetadataSearchRedaction
Leave feedback
On this page
Inheritance: java.lang.Object, com.groupdocs.redaction.Redaction, com.groupdocs.redaction.redactions.MetadataRedaction
public class MetadataSearchRedaction extends MetadataRedaction
Represents a metadata redaction that searches and redacts metadata using regular expressions, matching keys and/or values.
Learn more
- More details about applying redactions: Redaction basics
- More details about document metadata redactions: Metadata redactions
The following example demonstrates how to search and redact certain text in specific metadata.
try (Redactor redactor = new Redactor("C:\\sample.docx"))
{
MetadataSearchRedaction redaction = new MetadataSearchRedaction("Company Ltd.", "--company--");
// If not set, applies to all metadata items
redaction.setFilter( MetadataFilters.Company );
redactor.apply(redaction);
redactor.save();
}
| Constructor | Description |
|---|---|
| MetadataSearchRedaction(String valuePattern, String replacement) | Initializes a new instance of MetadataSearchRedaction class, using value to match redacted items. |
| MetadataSearchRedaction(String valuePattern, String replacement, String keyPattern) | Initializes a new instance of MetadataSearchRedaction class, using item name and value to match redacted items. |
| MetadataSearchRedaction(Pattern valueRegex, String replacement) | Initializes a new instance of MetadataSearchRedaction class, using value to match redacted items. |
| MetadataSearchRedaction(Pattern valueRegex, String replacement, Pattern keyRegex) | Initializes a new instance of MetadataSearchRedaction class, using item name and value to match redacted items. |
| Method | Description |
|---|---|
| getValueExpression() | Gets the regular expression to match value text of a metadata item. |
| getReplacement() | Gets the textual replacement value. |
| getKeyExpression() | Gets the regular expression to match name (key) of metadata item. |
| getDescription() | Returns a string, describing the redaction and its parameters. |
public MetadataSearchRedaction(String valuePattern, String replacement)
Initializes a new instance of MetadataSearchRedaction class, using value to match redacted items.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| valuePattern | java.lang.String | Regular expression to search and replace |
| replacement | java.lang.String | Textual replacement |
public MetadataSearchRedaction(String valuePattern, String replacement, String keyPattern)
Initializes a new instance of MetadataSearchRedaction class, using item name and value to match redacted items.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| valuePattern | java.lang.String | Regular expression to search and replace metadata item value |
| replacement | java.lang.String | Textual replacement |
| keyPattern | java.lang.String | Regular expression to search and replace metadata item name |
public MetadataSearchRedaction(Pattern valueRegex, String replacement)
Initializes a new instance of MetadataSearchRedaction class, using value to match redacted items.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| valueRegex | java.util.regex.Pattern | Regular expression to search and replace |
| replacement | java.lang.String | Textual replacement |
public MetadataSearchRedaction(Pattern valueRegex, String replacement, Pattern keyRegex)
Initializes a new instance of MetadataSearchRedaction class, using item name and value to match redacted items.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| valueRegex | java.util.regex.Pattern | Regular expression to search and replace metadata item value |
| replacement | java.lang.String | Textual replacement |
| keyRegex | java.util.regex.Pattern | Regular expression to search and replace metadata item name |
public final Pattern getValueExpression()
Gets the regular expression to match value text of a metadata item.
Returns: java.util.regex.Pattern - The regular expression to match value text of a metadata item.
public final String getReplacement()
Gets the textual replacement value.
Returns: java.lang.String - The textual replacement value.
public final Pattern getKeyExpression()
Gets the regular expression to match name (key) of metadata item.
Returns: java.util.regex.Pattern - The regular expression to match name (key) of metadata item.
public String getDescription()
Returns a string, describing the redaction and its parameters.
Returns: java.lang.String - Text, containing redaction name and parameters.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.