Script should do it in two steps:
1. find all occurences of i.e. ">DEFAULT<"
2. remove whole paragraph which is a found_text's container.
For example this way -JS - (a textFrame filled with your text should be selected) :
var mStory = app.selection.parentStory; app.findTextPreferences = null; app.findTextPreferences.findWhat = ">DEFAULT<"; var myF = mStory.findText(); var count = myF.length; while (count--) myF[count].paragraphs.remove();
Hi, thanks for you help, this has worked very well
I did not like your 2 stage looped code whether it works or not!
This is a bit more efficient . One could make it shorter but I think this is safer.
app.changeGrepPreferences = app.findGrepPreferences = null; app.findGrepPreferences.findWhat = "\\s*<.+>DEFAULT</.+>\r"; app.activeDocument.changeGrep();
Basically, I agree.
2 stage code is used because textFind() is in it. Grep is more efficient
but it needs a deeper knowledge, which is a mother of safety, in fact.
Since "\s" catches "\r" ==> this Grep removes a previous "end of paragraph".
I am not sure it is a goal, but maybe it is...
Questions & answers on our forum are "out of context" most often
I have a problem which is a bit different. I want to replace part of my text within an XML tag across multiple XML files. For example, in the following tag I want to replace "../../../../Resource" with "../../../../Library". I don't want to make any changes to the tag or remaining text.