Free Support Forum - aspose.com

Words FIND

Hi,

my goal is to “collect” all the words (sequence of letters or numbers or underscore and nothing else) beginning with a “target pattern” (for example “@@”).
I’m trying with something like

Pattern regex = Pattern.compile("(?-i)@@[A-Z0-9a-z]*");
document.getRange().replace(regex, new ReplaceHandler(), true);

and, in the ReplaceHandler class

System.out.println(“Found [” +repArgs.getMatchNode().getText() +"]");
return ReplaceAction.SKIP;

The program prints out the “target word” and, in most cases, extra characters before the “@@” or at the end of the word or both).

Any solution?

The second step will be to delete (substitute with a space) them and EXACTLY them (I cannot delete any extra character).

Regards,
Roberto

Hi Roberto,


Thanks for your inquiry. Could you please attach your input Word document here for testing?

Please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate as to how you want your final Word output be generated like. We will then provide you more information on this along with code.