-2

My expression for matching is \Qbar0\E

I try to ignore specific symbols, such as 0|

I need to find matches in the word not considering specific symbols

For example:

1) Search matches in the foobar0 - matches should be found

2) Search matches in the foobar0| - matches should be not found

3) Search matches in the foobar0|0 - matches should be not found

This case can be done with regex?

millka_15
  • 359
  • 1
  • 10
  • What do you mean with "specific symbols"? Are there more to consider? Can you also further define what `Q` stands for and what a valid input would be? In what application are you working btw? – JvdV Jun 11 '20 at 10:33
  • What language/tool are you using? From the [regex tag info](https://stackoverflow.com/tags/regex/info): "Since regular expressions are not fully standardized, all questions with this tag should also include a tag specifying the applicable programming language or tool.". Could you give more context? – Toto Jun 11 '20 at 10:34
  • It's a non-sense to surround `bar0` with `\Q...\E`, there're no special char in it. – Toto Jun 11 '20 at 10:36
  • Is [that](https://regex101.com/r/w65d6z/1) what you want? – Toto Jun 11 '20 at 10:38
  • 1
    I think the question is too vague to answer. –  Jun 11 '20 at 10:41

1 Answers1

0

Not sure I well understand, but using a negative lookahead will do the job:

bar0(?![|])

Demo & explanation

Toto
  • 83,193
  • 59
  • 77
  • 109