Beenden
  • Globale Community
    • Sprache:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

InDesign GREP | Target first tab of two tabs

Community-Einsteiger ,
Feb 13, 2018 Feb 13, 2018

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.

4.2K
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines

correct answers 1 richtige Antwort

Community Expert , Feb 15, 2018 Feb 15, 2018

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

P.

Übersetzen
Mentor ,
Feb 14, 2018 Feb 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:

1stTab.png

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

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Ratgeber ,
Feb 14, 2018 Feb 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.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Mentor ,
Feb 14, 2018 Feb 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.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Ratgeber ,
Feb 14, 2018 Feb 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.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Mentor ,
Feb 14, 2018 Feb 14, 2018

Anna+Lander  wrote

Using GREP is usually a bit more difficult.

... and a lot more fun

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Ratgeber ,
Feb 14, 2018 Feb 14, 2018

agree

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community-Einsteiger ,
Feb 14, 2018 Feb 14, 2018

Anna Lander​, winterm​:

Thank you for your replies and sorry for my delayed response.

What version of InDesign?

InDesign CC (13.0.1)

What's your final goal? … Apply formatting?

Yes, to apply formatting (specifically, a character style).

How many 'tab groups' can occur in one paragraph?

The paragraph may have just one tab (all by itself) or multiple "tab groups".

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?

Yes, I'd like to match single tabs and the first tab of two tabs.

E.G.,

first-tab.png

I hope this provides clarification.

I thought this GREP rule: (?<!\t)\t

…specified "a tab not preceded by a tab"; however, the character style is applied to all tabs.

Thank you for your attention.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community-Einsteiger ,
Feb 14, 2018 Feb 14, 2018

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.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Ratgeber ,
Feb 15, 2018 Feb 15, 2018

mynameischarles  wrote

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

(?<!\t)\t

[...] does not work.

Excellent question!

I would also assume this to work. But it does not, I can confirm that.

Looks like there's some kind of limitation when matching pattern is the same than the assertion pattern.

Really don't know why and would to love to hear from our Grep experts Obi-wan Kenobi​, Peter Kahrel​ and others...

foo2.jpg

Tested in regexr.com:

foo.jpg

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Feb 15, 2018 Feb 15, 2018
AKTUELL

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

P.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines