Skip to main content
Participant
February 14, 2018
Answered

InDesign GREP | Target first tab of two tabs

  • February 14, 2018
  • 2 replies
  • 4169 views

I have text then either one or two tabs. Sometimes the text is followed by a space and sometimes it is not.

I thought I could target the first tab with the following:

(?<!\t)\t

I.E., find a tab not preceded by a tab.

Unfortunately, this does not work as intended, but I can't figure out why. I've tested variations such as "find a word character not preceded by a tab" and "find a tab preceded by a tab", etc., and those all work.

I would appreciate any clarification.

This topic has been closed for replies.
Correct answer Peter Kahrel

Anna Lander​, winterm​:

I've discovered that this GREP rule achieves the result I'm looking for:

(?<=[^\t])\t

…I.E., "a tab preceded by any character that is not a tab."

However, I still don't understand why my original GREP rule:

(?<!\t)\t

…I.E., "a tab not preceded by a tab" does not work.


Looks like a bug to me. Please report it: Adobe InDesign Feedback

P.

2 replies

Anna Lander
Inspiring
February 14, 2018

if you want just decrease the tab quantity (to have only 1 tab at each place), you can use the easiest way: Find/Change dialog box -> Find What field -> ^t^t, Change To field -> ^t. Repeat "Change All" until the operation result alert says "0".

But other tasks will need other solutions.

winterm
Legend
February 14, 2018

Anna,

something like

find: \x{20}*\t+\x{20}*

change to: \t

will allow to clean up all your tabs in one go, including those obsolete spaces.

however, I don't think OP's request is that simple.

still need elaborating.

Anna Lander
Inspiring
February 14, 2018

yes. And I'm waiting for the request clearing.
And I said about easiest way (maybe it's not the most effective, but requires from user the minimal knowledge and experience )

Using GREP is usually a bit more difficult.

winterm
Legend
February 14, 2018

Hi there, some clarifications needed.

What version of InDesign?

What's your final goal? Merge multiple tabs? Replace first tab with something else? Apply formatting?

How many 'tab groups' can occur in one paragraph? Just one, or more?

You want to 'target first tab of two tabs', on the other hand, you're looking for 'a tab not preceded by a tab'. This will match any single tab, too?

Maybe simple Nested Style is enough? Like this:

Not to mention spaces, that are pointless with the tabs, usually...