Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Grep with multiple nots

New Here ,
Apr 30, 2019 Apr 30, 2019

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.

TOPICS
Scripting
577
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 01, 2019 May 01, 2019

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.

Translate
Community Expert ,
May 01, 2019 May 01, 2019

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 01, 2019 May 01, 2019

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 13, 2019 May 13, 2019
LATEST

I have not tried it yet but I assume it will work. Thanks so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines