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

Find/Replace grep help

Engaged ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

I'm trying to find  something that matches a lookbehind of spaces or opening brackets but can't make it work. I want to be able to find a b c when preceeded by a space or opening bracket, but not capturing the space or bracket.

 

I want it to be the following but it seems classes don't work in positive lookbehind:

(?<=[ \(])[acb]

Looks simple enough but much googling is yielding nothing, I'm probably seartching for the wrong terms.

TOPICS
How to

Views

116

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 , Jun 30, 2022 Jun 30, 2022

Hi @MrZZY 

 

Try:

 

(?<=\s|\[)abc

 

~Barb

 

grep2.gif

Votes

Translate

Translate
Community Expert ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

Hi @MrZZY 

 

Try:

 

(?<=\s|\[)abc

 

~Barb

 

grep2.gif

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 ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

Thanks so much! I meant opening parentheses (I don't know if it's the same where you are but in the UK brackets is often used to mean parenthese) but your answer contained the solution in terms of using the pipe character. 

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 ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

LATEST

Hi @MrZZY:

 

The pipe character means "or" so for example, look for a leading space before "abc" or look for the open bracket/parenthesis before "abc". 

 

And in the US, these are parentheses ( ) and these are brackets [ ], so we both learned something. 😊

 

~Barb

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