com.groupdocs.redaction.redactions

Class RegexRedaction



  • public class RegexRedaction
    extends TextRedaction

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

    • Constructor Detail

      • RegexRedaction

        public RegexRedaction(String pattern,
                      ReplacementOptions options)

        Initializes a new instance of RegexRedaction class.

        Parameters:
        pattern - Regular expression to search and replace
        options - Replacement options (textual, color)
      • RegexRedaction

        public RegexRedaction(Pattern regex,
                      ReplacementOptions options)

        Initializes a new instance of RegexRedaction class.

        Parameters:
        regex - Regular expression to search and replace
        options - Replacement options (textual, color)
    • Method Detail

      • getRegularExpression

        public final Pattern getRegularExpression()

        Gets the regular expression to match.

        Returns:
        The regular expression to match.
      • applyTo

        public RedactorLogEntry applyTo(DocumentFormatInstance formatInstance)

        Applies the redaction to a given format instance.

        Specified by:
        applyTo in class Redaction
        Parameters:
        formatInstance - An instance of a document to apply redaction
        Returns:
        Status of the redaction: success/failure and error message if any