Inconsistent GREP Matching Behavior: Pattern Fails on Long Text Strings
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)
