Redact PDFs using regex

Nutrient Web SDK allows you to search text matching a regular expression and redact it.

Try for free Launch demo

You can use instance.createRedactionsBySearch to do this:

await instance.createRedactionsBySearch("J[a-zA-Z]+t", {
  searchType: PSPDFKit.SearchType.REGEX
});

The code above will search all the four-letter words in the document and add redaction annotations over them. If you’re happy with the added redaction annotations, you can apply them using instance.applyRedactions. This is an irreversible process.

Keep in mind that each setup uses a different regex syntax: