Copy link to clipboard
Copied
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.
Looks like a bug to me. Please report it: Adobe InDesign Feedback
P.
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Anna+Lander wrote
Using GREP is usually a bit more difficult.
... and a lot more fun
Copy link to clipboard
Copied
agree
Copy link to clipboard
Copied
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.,
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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...
Tested in regexr.com:
Copy link to clipboard
Copied
Looks like a bug to me. Please report it: Adobe InDesign Feedback
P.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now