Aspose Word has text over multiple Run after edit

Hello,
I have a document which has multiple examples of text between two specific prefix and delimiter. I need to read this document and find those texts and save them in a list. I have used visitRun to check run.getText() and see if the text contains those prefix and delimiter. However after I modify the document in the Microsoft Word, this code does not work properly as now the text is between multiple Runs. For example I have this: @<ASK>Hello@ after I modify it in the Microsoft Word and add an extra l @<ASK>Helllo@, my program does not return the Helllo correctly. It has this word in more than one Run. I have attached a part of the code with instruction and input and output in the attached folder.
Thanks for your help.
My_test.zip (63.6 KB)

@farnaz2021 This is a common behavior when after editing the document MS Word breaks the run. Usually, you can use Document.joinRunsWithSameFormatting method to merge runs with the same formatting.

In your case however, there is a bookmark between the runs:

You can use find/replace functionality to mare the placeholder to be represented as a single Run:

Document doc = new Document("C:\\Temp\\modified.docx");
        
Pattern regex = Pattern.compile("@\\<ASK\\>[\\w+\\s]+?@");
FindReplaceOptions opt = new FindReplaceOptions();
opt.setUseSubstitutions(true);
doc.getRange().replace(regex, "$0", opt);
        
doc.save("C:\\Temp\\out.docx");

After running the above code, the result looks like this: