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

Grep help please

Participant ,
Mar 14, 2024 Mar 14, 2024

Copy link to clipboard

Copied

Having a problem trying to apply bold char style to instances of text between parenthesis and quotations e.g ("xyz")

 

Grep expression I've used is: (?<=\(“).*(?=”\))

 

It works partially but when there is more than one instance in a paragraph it is not working as intended and highlights more than intended. Screenshot below showing this situation. Can someone please tell me what expression should be used to correct this? Thanks.

 

Screenshot 2024-03-14 at 9.32.07 pm.png

TOPICS
How to

Views

152

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

correct answers 1 Correct answer

Community Expert , Mar 14, 2024 Mar 14, 2024

Change your GREP query to this one:

(?<=\(“).+?(?=”\)) instead of *

Capture d’écran 2024-03-14 à 12.44.28.png

In English, it should be “one or more times (shortest match)”

Votes

Translate

Translate
Community Expert ,
Mar 14, 2024 Mar 14, 2024

Copy link to clipboard

Copied

Change your GREP query to this one:

(?<=\(“).+?(?=”\)) instead of *

Capture d’écran 2024-03-14 à 12.44.28.png

In English, it should be “one or more times (shortest match)”

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
Participant ,
Mar 14, 2024 Mar 14, 2024

Copy link to clipboard

Copied

Thanks!

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 14, 2024 Mar 14, 2024

Copy link to clipboard

Copied

@danielw42205661 

 

GREP, by default, is "greedy".

 

"?" in @jmlevy reply makes it "non-greedy" / "lazy" - so GREP will be looking for the "shortest match".

 

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
Participant ,
Mar 14, 2024 Mar 14, 2024

Copy link to clipboard

Copied

LATEST

Thanks Robert, good to know 🙂

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