Skip to main content
March 27, 2009
Question

Limit to number of GREP replacement text?

  • March 27, 2009
  • 5 replies
  • 1014 views
Does anyone know if there is a limit to the number of replacement text (atoms) in InDesign GREP? I'm trying to parse data into 17 separate replacement text (atoms) but InDesign only seems to recognize $1, $2, $3, $4, $5, $6, $7, $8, and $9. InDesign GREP does not recognize $10, $11, $12, $13, etc. What InDesign GREP does instead is to insert $1 plus the number 0, 1, 2, 3, etc. So it seems that InDesign GREP has a limit of 9 replacement text (atoms). Is there a way to get InDesign to recognize more than 9?

I know I can probably accomplish this in two separate searches, but I would rather do it correctly in one search.

Here's my GREP example:

FIND: ^(.{2})(.{11})(.{21})(.{8})(.{4})(.{11})(.{6})(.{5})(.{5})(.{11})(.{8})(.{37})(.{13})(.{14})(.{4})(.{10})(.*)\r

CHANGE: $1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$11\t$12\t$13\t$14\t$15\t$16\t$17\r

EXMAPLE DATA (inside the brackets): [ 101317 ABC BRAKES USA LTD ABC 754 1 4C FULL 4C RU 11 STOP FAST 9 188216-XXXX-090600 XXXX 090030 C3 PROOF WAIVED HOR 3 COL ]

I hope I explained the properly. Let me know if you need clarification.

5 replies

Known Participant
March 28, 2009
my understanding of your GREP rule:

^ <- beggining of paragraph
(.{x}) <- exactly x any characters - including letter, numbers and white spaces except \r and \n
(.*) <- 0 or more of any character - including letter, numbers and white spaces except \r and \n
\r <- end of paragraph

so - after counting all numbers - your line should find all lines with minimum number of 171 characters ...

without spaces between (.{x}) - your line is equal to:

^(.{171,})\r

robin

--
www.adobescripts.com
Velgates
Participant
January 9, 2025

Hope this remains the same and there is no update.

March 27, 2009
> You realize your sample shows every single space being replaced by a single tab? Just checking.

It's putting a tab after X amount of characters, not every space.

Maybe someone from Adobe can verify if there is a limit in InDesign GREP.... or a method to get around the apparent 9 limit.
Inspiring
March 27, 2009
On 28/3/09 7:13 AM, "Dave Saunders" <member@adobeforums.com> wrote:<br /><br />> I believe that GREP by definition cannot go beyond $9.<br /><br />Not really -- quite a few implementations can handle up to 99<br />backreferences. In fact, these days I suspect more do than don't. But it's<br />hardly a great limitation in something like InDesign.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Sessions <a href=http://scriptingmatters.com/aspro>
Jongware
Community Expert
Community Expert
March 27, 2009
You realize your sample shows every single space being replaced by a single tab? Just checking. :-D

Perhaps these lines have something unique, a special paragraph style for example -- in that case you could replace space by tab for that style alone.
If there are other lines around with the same style, or something like that, you could
i make
them special, by, f'r instance, changing the text colour or something. And yes, that means more than a single replace operation.
Inspiring
March 27, 2009
I believe that GREP by definition cannot go beyond $9.

Dave