// سند را بارگذاری کنید
final Redactor redactor = new Redactor("source.docx");
try
{
// یک الگوی regex ایمیل و متن جایگزین را تنظیم کنید
ReplacementOptions repl_opt = new ReplacementOptions("[redacted]");
String emailRegex = "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}";
RegexRedaction redaction = new RegexRedaction(emailRegex, repl_opt);
// ویرایش را اجرا کنید
redactor.apply(redaction);
// فایل پاکشده را ذخیره کنید
SaveOptions saveOptions = new SaveOptions();
saveOptions.setAddSuffix(true);
saveOptions.setRasterizeToPDF(false);
redactor.save(saveOptions);
}
finally { redactor.close(); }