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

Limit to number of GREP replacement text?

Guest
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

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.
TOPICS
Scripting

Views

844

Translate

Translate

Report

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
Participant ,
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

I believe that GREP by definition cannot go beyond $9.

Dave

Votes

Translate

Translate

Report

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
Community Expert ,
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Advocate ,
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

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
Guest
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

> 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.

Votes

Translate

Translate

Report

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
Community Beginner ,
Mar 28, 2009 Mar 28, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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 ,
Jan 09, 2025 Jan 09, 2025

Copy link to clipboard

Copied

LATEST

Hope this remains the same and there is no update.

Votes

Translate

Translate

Report

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