Skip to main content
Participant
August 26, 2025
Question

Inconsistent GREP Matching Behavior: Pattern Fails on Long Text Strings

  • August 26, 2025
  • 1 reply
  • 109 views

I found a weird behavior using GREP in Adobe InDesign.

 

GREP query:

<p class="h3l">(.+?)<\/p>

 

This works fine when the capturing group (found text) is short, but when the matching text is very large, it does not match.

 

I have tried with multiple alternative

Like

 

  • <p class="h3l">([^r]+)<\/p>
  • <p class="h3l">(.{1,})<\/p>
  • <p class="h3l">(.+?)<\/p>$

 

But these also does not match.

 

Then i try <p class="h3l">.{1,} to see how many characters it can match.

But somehow it matches at a certain point, not whole text before line break. I tried this GREP query multiple times, surprisingly it give different result each time. It matches different length of characters each time.

 

I tried this expression in other text editors where it matches correctly.

 

Adobe InDesign Version:
InDesign July 2025 (20.5)

 

1 reply

Community Expert
August 28, 2025

Hi @Bilal__ ,

please provide a sample InDesign document where the expression is successful and one where it is not.

Just attach the documents to your answer using the forum's editor ( and not by replying through mail ).

 

Thanks,
Uwe Laubender
( Adobe Community Expert )