Regex to match specific strings without a given prefix

前端 未结 1 1114
名媛妹妹
名媛妹妹 2021-01-31 01:40

I need to match all of its lines that contains a value and that don\'t have a given prefix.

Example: I want all lines that contains word when it\'s not pref

相关标签:
1条回答
  • 2021-01-31 02:05

    You may need

    (?<!prefix )word
    

    (and maybe take care of the spaces).

    (?!) is a negative lookahead but in your case you need a negative lookbehind (i.e. (?<!)).

    0 讨论(0)
提交回复
热议问题