This topic contains 5 replies, has 3 voices, and was last updated by stuarth64 1 year, 1 month ago.
I am writing a script that uses several grep find/change queries. They all work apart from this one “\\Z\\r” that aims to delete the last return at the end of a story.
This and variations of it work fine in the find/change dialog but not in the script. Any help would be much appreciated.
In a script, try using positive lookahead “\\r(?=\\Z)” for findWhat property. Note, this will also delete the last return at the end of any table cell as well. Works in InDesign CS6.
Actually you don’t need a lookahead for the ‘position markers’ $ and \Z. Stuart mentions he tried some variations, but maybe he overlooked the simplest possible case:
— that is, the return occurs *before* the end of story.
I thought that should work, but I tried \\r\\Z using InDesign CS6 on Mac and could not get it to work.
\\r\\Z does appear to work in InDesign CC.
Thank you guys for your help with this. Jongware, I could have sworn I’d tried that variation but obviously not as it works a treat in CC.
You must be logged in to reply to this topic.
Our guide to discovering all the
great resources on the site!
© 2006 - 2015 InDesignSecrets.com All Rights Reserved