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

21847Re: [Clip] Remove all lines not containing something

Expand Messages
  • diodeom
    Jun 29, 2011
    • 0 Attachment
      I wrote:
      > I understand the objective to be removal of lines in which certain
      > terms are absent.

      A funky one-line take could be something like:

      ^!Replace "^((.*\.(org|net).*)|.++)(\R|\Z)(?(2)\K)" >> "" WARS

      ... where the "(?(2)\K)" bit is a conditional subpatern that checks if $2, that is the "(.*\.(org|net).*)" substring was captured, and if so, resets the whole capture with \K to nothing, so the empty replacement leaves this line intact. When $2 isn't captured, the selection remains ready for its subsequent wipe-out.
    • Show all 30 messages in this topic