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

Re: [Clip] Remove all lines not containing something

Expand Messages
  • flo.gehrke
    ... Yes, Don, that s the way it works because it was adapted to the data in your first message... ... where the strings in question are positioned at the end
    Message 1 of 30 , Jun 30, 2011
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, Don <don@...> wrote:

      > Your look behind works only if it is at the end of the line.

      Yes, Don, that's the way it works because it was adapted to the data in your first message...

      > Input:
      > john@...
      > jane@...
      > jeff@...
      > fred@...

      where the strings in question are positioned at the end of line.

      Different from these data, now the substrings in question ('Grand Blanc' or 'Alpena') are not to be found at the end of line but on any position in line. So the command to delete all lines that do NOT contain 'Grand Blanc' or 'Alpena' can be a little bit shorter...

      ^!Replace "^(?!.*(Grand Blanc|Alpena)).*(\R|\Z)" >> "" WARS

      However, your latest information shows that this job is more based on *positive* criteria (find 'Grand Blanc' or 'Alpena') than on *negative* criteria (exclude 'com' or 'ru' in your first message). So, in this case, it probably is of no advantage to work with a Lookaround. Maybe it will suffice just to run something like...

      ^!SetClipboard ^$GetDocListAll("^.*(Grand Blanc|Alpena).*(\R|\Z)";$0)$
      ^!Toolbar New Document
      ^$GetClipboard$

      If you want to overwrite the original list you could try...

      ^!Select All
      ^$GetDocListAll("^.*(Grand Blanc|Alpena).*(\R|\Z)";$0)$

      Regards,
      Flo
    Your message has been successfully submitted and would be delivered to recipients shortly.