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

Re: [Clip] Re: How to set a clip capable of deleting lines without particaluar content?

Expand Messages
  • buralex@gmail.com
    ebbtidalflats said on Jul 06, 2007 12:54 ... Eb, Flo, Sheri: I think the following *SHOULD* identify the lines that do NOT match -
    Message 1 of 32 , Jul 6, 2007
    • 0 Attachment
      "ebbtidalflats" <ebbtidalflats@...> said on Jul 06, 2007 12:54
      -0400 (in part):
      > I'm impressed. But how do you use this technique to REMOVE the matches?
      > What if I want to keep only those lines, that DO NOT contain my target
      > string?
      Eb, Flo, Sheri:
      I think the following *SHOULD* identify the lines that do NOT match -
      perhaps a bug?

      H="Temp"
      ^!SetListDelimiter ^P
      ^!Set %Search%=^?{Enter search string:}
      ^!Set %hasSearch%=^.*^%Search%.*$
      ^!Set %notSearch%=^.*$
      ^!Set %either%=(?i)(^%hasSearch%)|(^%notSearch%)

      ^!set %lines_0%=^$GetDocMatchAll(^%either%;0)$
      ^!set %lines_1%=^$GetDocMatchAll(^%either%;1)$
      ^!set %lines_2%=^$GetDocMatchAll(^%either%;2)$

      ^!set %i%=0
      :loop
      ^!info lines_^%i% =^P= ^%either% =^P= ^%lines_^%i%%
      ^!inc i
      ^!if ^%i% <3 loop
      :done

      Technique used is to alternate:
      a regex which matches a whole line containing %search% (%hasSearch%) and
      a regex which matches ANY line %notSearch%.

      try it against this test data:

      four horses
      a cat
      a dog
      four tigers
      a dog and a cat
      two dogs
      two cats
      two cats and three dogs


      try using Search=

      * cat
      * dog
      * (?cat|dog)

      Note that

      * lines_0 is set to all lines
      * lines_1 is set only lines containing %Search%
      * lines_2 is set to the lines before the first line containing %Search%

      Sheri - you said something about a problem with ^$GetDocMatchAll. I
      don't recall the details or whether this might be an example of it?

      FWIW: RegexBuddy is able to use this pattern to identify group-2 matches
      (those not containing the target)

      Regards ... Alec -- buralex-gmail
      --



      [Non-text portions of this message have been removed]
    • loro
      ... Thank you, Flo. At least there is a significant difference. I m a little shocked. I hadn t noticed before that Notetab has gotten slower in some respects.
      Message 32 of 32 , Jul 6, 2008
      • 0 Attachment
        Flo wrote:
        >With ^!SetScreenUpdate Off your Clip needs 32 seconds to run my test
        >(reducing 15,000 to 234 lines). I'm working with a 1,6-GHz-Notebook.

        Thank you, Flo. At least there is a significant difference. I'm a
        little shocked. I hadn't noticed before that Notetab has gotten
        slower in some respects.

        Lotta
      Your message has been successfully submitted and would be delivered to recipients shortly.