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

RE: [Clip] Assertion behavior - was - RE: [NTS] Can a Reg Exp handle 123 AND not a|b|c followed by x?

Expand Messages
  • John Shotsky
    Further testing shows that I didn t have the clips exactly the same in 6.2 and 7. In one case there is an [s?]on the end of notes, and in the other case there
    Message 1 of 2 , May 16, 2012
    • 0 Attachment
      Further testing shows that I didn't have the clips exactly the same in 6.2 and 7. In one case there is an [s?]on the end
      of notes, and in the other case there isn't. It is when the question mark is present that the failure occurs in both 6.2
      and 7. But still, I would have expected it to work, especially because the 's' is present - so that condition should
      have been satisfied before the look behind started looking. So, the question for me, then, is how do I prevent this
      erroneous action in the lookbehind, since the s? term must be present?

      These are the two clips as they produce the error:
      ;^!Replace "^(Notes?)(?!::)" >> "Dir::$1" ARSW
      ^!Replace "^Notes?(?!::)" >> "Dir::" ARSW
      Regards,
      John
      RecipeTools Web Site: http://recipetools.gotdns.com/


      -----Original Message-----
      From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of John Shotsky
      Sent: Wednesday, May 16, 2012 18:05
      To: ntb-clips@yahoogroups.com
      Cc: ntb-scripts@yahoogroups.com
      Subject: [Clip] Assertion behavior - was - RE: [NTS] Can a Reg Exp handle 123 AND not a|b|c followed by x?

      Flo (and all)
      Attempting to use the negative assertion function discussed below, but with bewildering results.
      I have two versions of a clip. One works as expected, the other doesn't. I can't see why the difference.
      Here are the two versions. To run them, just comment one out and run the other.
      ;^!Replace "^(Notes)(?!::)" >> "Dir::$1" ARSW
      ^!Replace "^Notes(?!::)" >> "Dir::" ARSW

      The goal is to place a Dir:: tag in front of any Notes tag that is not followed by [::].
      Here is the text sample:
      Notes::Note1: The traditional way to prepare this dish does not call for the removal of the vein from the prawn.

      It appears to work in v6.2, but it was a bit erratic - there were times when it didn't work, but it seems to be working
      correctly now. I will be retesting to see if I can get it to fail again. But in version 7, the first clip always fails
      the negative assertion and thus places the Dir:: tag when it shouldn't.

      Can anyone see anything I'm doing wrong, or is this a regex bug?

      Regards,
      John
      RecipeTools Web Site: http://recipetools.gotdns.com/


      -----Original Message-----
      From: ntb-scripts@yahoogroups.com [mailto:ntb-scripts@yahoogroups.com] On Behalf Of John Shotsky
      Sent: Thursday, May 10, 2012 09:13
      To: ntb-scripts@yahoogroups.com
      Subject: RE: [NTS] Can a Reg Exp handle 123 AND not a|b|c followed by x?

      Flo,
      Thank you. Always nice to learn something new. I will play around with this until I have it fully internalized. I have
      needed this function quite a few times and have 'tokenized' and then used a character class instead. (And then
      untokenized.) This is obviously a better way to do it.

      Regards,
      John
      RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/

      From: ntb-scripts@yahoogroups.com [mailto:ntb-scripts@yahoogroups.com] On Behalf Of flo.gehrke
      Sent: Thursday, May 10, 2012 07:46
      To: ntb-scripts@yahoogroups.com
      Subject: Re: [NTS] Can a Reg Exp handle 123 AND not a|b|c followed by x?


      --- In ntb-scripts@yahoogroups.com <mailto:ntb-scripts%40yahoogroups.com> , "John Shotsky" <jshotsky@...> wrote:
      >
      > I am not understanding something here – The criteria was:
      > three characters that are *NOT* MON|TUE|WED|THU|FRI|SAT|SUN
      >
      > How is this avoiding those strings? I've wanted to do this text
      > that didn't contain a certain string on multiple occasions.
      >

      John,

      The second part of that RegEx...

      \((?!Mon|Tue|Wed|Thu|Fri|Sat|Sun).{3}\)

      matches an opening and a closing literal bracket '(...)' embracing three digits '.{3}' that are NOT 'Mon', 'Tue' etc, as
      Joy demanded.

      The 3-digit-days are excluded with a Negative Lookahead. Since a Lookahead doesn't consume any character, any different
      3-digit-string will match at the same position between the opening and the closing bracket. That's why, for example,..

      'John' is matched with '(?!Mary)John'

      that is: Find 'John' at a position where you don't see 'Mary' when looking ahead.

      Regards,
      Flo



      [Non-text portions of this message have been removed]



      ------------------------------------

      Fookes Software: http://www.fookes.com/
      NoteTab website: http://www.notetab.com/
      NoteTab Discussion Lists: http://www.notetab.com/groups.php

      ***
      Yahoo! Groups Links





      ------------------------------------

      Fookes Software: http://www.fookes.com/
      NoteTab website: http://www.notetab.com/
      NoteTab Discussion Lists: http://www.notetab.com/groups.php

      ***
      Yahoo! Groups Links
    Your message has been successfully submitted and would be delivered to recipients shortly.