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

GREP exeptions between brackets

Engaged ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

Hi.

 

I have this GREP in a paragraphstyle :

 

 

 

 

(?<!\(.*)((firstExpression)|(secondExpression)|(thirdExpression))|(fourthExpression)

 

 

The text has to be changed is:

 

Text firstExpression Text Text Text secondExpression Text Text Text thirdExpression
fourthExpression Text Text (firstExpression, Text Text secondExpression Text Text Text, thirdExpression)

It doesn´t work at all.

 

But with this one:

 

 

(?<!\()((firstExpression)|(secondExpression)|(thirdExpression))|(fourthExpression)

 

Except words between brackets not standing directly behind a bracket(red). They don't get bold.

Where is the bug in my GREP?

 

 

TOPICS
Performance , Print , Type

Views

321

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 ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

I did not understand your issue, can you specify what do you intend to find in your sample text, all the occurrences of firstExpression, secondExpression, thirdExpression, fourthExpression or only the one's that are inside ()

-Manan

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
Engaged ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

Okay.

In a catalogue there are, at each item, two paragraphs of the same style. In the first one the (key)words are in the text, without brackets. In the second paragraph the same words comes sometimes within brackets. The whole catalogue contains 8 words have to be catched with GREPs at each item-description.

 

This is how it has to look like:

 

Bildschirmfoto 2020-12-14 um 15.33.18.png

 

 

 

 

My problem is (in this case) word2 and word3 in the second paragraph.

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 ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

If I understand correctly then you just need to capture these unique words irrespective of whether they are between () or not. If that is the case then does the following not work for you

firstExpression|secondExpression|thirdExpression|fourthExpression

-Manan 

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
Engaged ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

Only if they are not between ( )!

 

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 ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

If possible, please show us these 8 words.

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
Engaged ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

They are German terms for printing on articles. But the point is, not to make them bold within parentheses.

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 ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

Ok

Dann hat dich bis jetzt jeder hier missverstanden.

 

Eine technisch nicht ganz so schöne, aber in den meisten Fällen funktionierende Variante wäre:

  • erstelle dir ein Zeichenformat Basis mit den Parametern des Absatzformates z.B. Farbe schwarz, regular
  • erstelle einen Grepstil, der alle gesuchten Begriffe (ohne die Umgebung einzubeziehen) in bold formatiert
  • erstelle dir einen Grepstil, der alles in runden Klammern mit dem Zeichenformat Basis überschreibt
\([^\)]*\)

 

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
Engaged ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

Ja, das wollte ich eigentlich vermeiden.

1.) würde aber gerne trotzdem eine Erklärung dafür haben, wieso mein reg. Ausdruck nicht funktioniert

2.) was bedeutet 

\([^\)]*\)
  • ?  

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 ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

Das Problem ist, dass Lookbehinds nicht mit unterschiedlichen Zeichenlängen umgehen können.

(Für positive Lookbehinds gibt seit einiger Zeit es die Alternative \K)

 

Aber du suchst nach Begriff/en, der/die NICHT nach einer öffnenden Klammer, eventuell mit unterschiedlicher Zeichenanzahl nachfolgend, stehen/t - und zusätzlich VOR eventuell unterschiedlichen Zeichen, die NICHT eine schließende Klammer sind, gefolgt von einer schließenden Klammer.

 

Mal sehen, ob die anderen Forenmitglieder nicht vielleicht doch noch einen Geniestreich „aus dem Hut“ zaubern können.

 

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 ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

\([^\)]*\)

bedeutet

  • öffnende Klammer
  • alles was keine schließende Klammer ist
  • null oder mehrere Male
  • schließende Klammer

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
Engaged ,
Dec 15, 2020 Dec 15, 2020

Copy link to clipboard

Copied

Danke für die Erklärung. Im Prinzip ging's mir um die eckige Klammer mit dem "Hütchen". Dieses kannte ich noch nicht. Werde es also erst einmal so versuchen, in der Hoffnung die Formatierung irgendwann mit einem einzigen Ausdruck lösen zu können.

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 ,
Dec 15, 2020 Dec 15, 2020

Copy link to clipboard

Copied

Die Klammer mit dem „führenden Hütchen“ findet alles was NICHT in der Klammer steht.

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
Explorer ,
Dec 15, 2020 Dec 15, 2020

Copy link to clipboard

Copied

Eigentlich würde für meine Zwecke auch:

\(.*\)

reichen, oder? Also alles was zwischen Klammern steht soll regular sein.

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 ,
Dec 15, 2020 Dec 15, 2020

Copy link to clipboard

Copied

Ja.

Aber dieser Grep ist gierig und findet alles von der ersten öffnenden bis zur letzten schließenden Klammer.

 

Also zuviel.

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
Engaged ,
Dec 15, 2020 Dec 15, 2020

Copy link to clipboard

Copied

LATEST

 

\(.+?\)

kürzeste Entsprechung.

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