RegexRedaction

Inheritance: java.lang.Object, com.groupdocs.redaction.Redaction, com.groupdocs.redaction.redactions.TextRedaction

public class RegexRedaction extends TextRedaction

Represents a text redaction that searches and replaces text in the document by matching provided regular expression.


Learn more

Constructors

Constructor Description
RegexRedaction(String pattern, ReplacementOptions options) Initializes a new instance of RegexRedaction class.
RegexRedaction(Pattern regex, ReplacementOptions options) Initializes a new instance of RegexRedaction class.

Methods

Method Description
getRegularExpression() Gets the regular expression to match.
getDescription() Returns a string, describing the redaction and its parameters.
applyTo(DocumentFormatInstance formatInstance) Applies the redaction to a given format instance.

RegexRedaction(String pattern, ReplacementOptions options)

public RegexRedaction(String pattern, ReplacementOptions options)

Initializes a new instance of RegexRedaction class.

Parameters:

Parameter Type Description
pattern java.lang.String Regular expression to search and replace
options ReplacementOptions Replacement options (textual, color)

RegexRedaction(Pattern regex, ReplacementOptions options)

public RegexRedaction(Pattern regex, ReplacementOptions options)

Initializes a new instance of RegexRedaction class.

Parameters:

Parameter Type Description
regex java.util.regex.Pattern Regular expression to search and replace
options ReplacementOptions Replacement options (textual, color)

getRegularExpression()

public final Pattern getRegularExpression()

Gets the regular expression to match.

Returns: java.util.regex.Pattern - The regular expression to match.

getDescription()

public String getDescription()

Returns a string, describing the redaction and its parameters.

Returns: java.lang.String - Text, containing redaction name and parameters.

applyTo(DocumentFormatInstance formatInstance)

public RedactorLogEntry applyTo(DocumentFormatInstance formatInstance)

Applies the redaction to a given format instance.

Parameters:

Parameter Type Description
formatInstance DocumentFormatInstance An instance of a document to apply redaction

Returns: RedactorLogEntry - Status of the redaction: success/failure and error message if any