Search code examples
regexultraedit

regexp anything but


I have an txt file with 65K lines. and not all are correct aligned.

So I need to replace the lines not ending with ;Yes or ;No with an space

Tried

^{^;Yes|^;No}$

Solution

  • Select Perl while enabling Regular Expressions. Put this in Find What:

    (?m)^.*$(?<!;Yes|;No)
    

    Put a space character in Replace with input field.

    Breakdown:

    • (?m) Enable multline flag
    • ^.*$ Match a whole line
    • (?<! Start of a negative lookbehind
      • ;Yes Last 4 characters shouldn't be ;Yes
      • | Or
      • ;No ;No
    • ) End of negative lookbehind

    Live demo