Search code examples
regexend-of-line

RegExp: How to find lines that don't end with some pattern?


I have a log-file. Most of the lines in it ends with some sub-string (for example it 0.02). I can filter that lines with pattern 0\.02$. But how I can filter rest lines, other than ending with 0.02?


Solution

  • You need a negative lookbehind assertion:

    (?<!\b0\.02)$