Loading ...
Sorry, an error occurred while loading the content.

22059Re: [Clip] regex to delete all lines not containing

Expand Messages
  • flo.gehrke
    Sep 5 9:36 AM
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, Don <don@...> wrote:

      >> ^!Set %Del%=^?{Remove lines not containing:}
      >> ^!Replace "^(?!.*(?:^%Del%)\b).*(\R|\Z)" >> "" WARS

      > What does the ?! at the beginning do however?
      > Negative look ahead? I don't get look aheads
      > fully just yet, when to use them, what to do with them.

      It says: Find a line where - beginning at the start of line ('^') - you do NOT see the search string (^%Del%) from any position when looking ahead. The search string may be preceded or followed by any character 0 or more times ('.*'). If this true, replace that line including a CRNL with an empty string (i.e. delete it). With '\Z', it also matches at the end of the subject string where no CRNL follows.

    • Show all 9 messages in this topic