GREP find not working in javascript
- This topic has 5 replies, 3 voices, and was last updated 10 years, 1 month ago by .
- You must be logged in to reply to this topic.
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / GREP find not working in javascript
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / GREP find not working in javascript
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:
\\r\\Z
— 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.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies allows us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
To provide the best experiences, we and our partners use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us and our partners to process personal data such as browsing behavior or unique IDs on this site and show (non-) personalized ads. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Click below to consent to the above or make granular choices. Your choices will be applied to this site only. You can change your settings at any time, including withdrawing your consent, by using the toggles on the Cookie Policy, or by clicking on the manage consent button at the bottom of the screen.
You have to be logged in to save.
Not a member? Join Today - it's FREE!