I want to change original text with replacement text using RegexRedaction where I need to decide replacement text based on original text as well after matched by pattern. I am looking for something like below.
IRedactionCallback ip = e -> {
if(e.getOriginalText().startsWith("99")) {
e.getReplacement().setReplacement("[override]");
}
return true;
};
Redactor redactor = new Redactor(indoc, loadOptions, new RedactorSettings(ip);
RegexRedaction r = new RegexRedaction("\d+{4}", new ReplacementOptions("[default value]"));