Copy link to clipboard
Copied
I am working in InDesign CC. I am trying to create a GREP script that finds all "normal periods" without a space, another period, forced line break, or com after it. So far I can find a period without one of these using something like: \d\.(?! ) but cannot figure out how to add the additional nots. Any suggestions?
Thanks in advance.
A lookahead does not consume characters so the (virtual) text cursor stays in its position after the last found text, but before the to-be-lookahead text. So you can add another lookahead right after that – even mix positive and negative ones.
For example, any word character except an uppercase would be
xxx(?=\w)(?!\u)
where both act on the same next character.
Copy link to clipboard
Copied
A lookahead does not consume characters so the (virtual) text cursor stays in its position after the last found text, but before the to-be-lookahead text. So you can add another lookahead right after that – even mix positive and negative ones.
For example, any word character except an uppercase would be
xxx(?=\w)(?!\u)
where both act on the same next character.
Copy link to clipboard
Copied
Ha! Seems so simple and straightforward. Sure, used to use lookahead and lookbehind simultaneously to get some kind of *look-around*, but due to obscured reason never thought about doubling parts. Very useful idea, thank you!
Copy link to clipboard
Copied
I have not tried it yet but I assume it will work. Thanks so much!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more