Copy link to clipboard
Copied
Hi,
I am trying to remove extra returns at the end of a story, but my script remove returns at the end of every paragraph.
How can I make it delete only extra returns at the end of a story?
function myFindGrepDelEmpty(myObject){
app.findGrepPreferences = null;
app.changeGrepPreferences = null;
app.findGrepPreferences.properties = {findWhat:"^\\s+|\\s+$"};
app.changeGrepPreferences.properties = {changeTo:""};
app.findChangeGrepOptions.properties = {includeFootnotes:true, includeMasterPages:false, includeHiddenLayers:true, wholeWord:false};
myObject.changeGrep();
}
First: ^\s+
Then: \s\z
\z just means "end of story"!
Copy link to clipboard
Copied
\s+\z
Copy link to clipboard
Copied
Michel,
thanks very much, that does the trick. But what does the "z" mean? It doesn't work in this combo: ^\s+|\s+\z.
Copy link to clipboard
Copied
First: ^\s+
Then: \s\z
\z just means "end of story"!
Copy link to clipboard
Copied
Thanks again, very helpful!