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

537RE: [NTS] Can a Reg Exp handle 123 AND not a|b|c followed by x?

Expand Messages
  • John Shotsky
    May 9, 2012
    • 0 Attachment
      Since negative character classes don't support strings, I would approach this by first inserting a special character in
      front of each of the day strings, then use a negative character clase that included that special character. Afterwards,
      I'd remove the special character.

      I wish there were a 'negative string' feature in PCRE, but the substitution of special characters does work well.

      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 mycroftj
      Sent: Wednesday, May 09, 2012 18:55
      To: ntb-scripts@yahoogroups.com
      Subject: [NTS] Can a Reg Exp handle 123 AND not a|b|c followed by x?


      Is there a relatively simple reg exp to find the following?

      Date in format mm/dd/yyyy OR yyyy/mm/dd followed by a space followed by an open paren followed by three characters that
      are *NOT* MON|TUE|WED|THU|FRI|SAT|SUN followed by a closing paren?

      I've gotten as far as the following that does all the above except for checking for the closing paren.

      ^!Find "(?:(\d\d/\d\d/(?:19|20)\d\d)|((?:19|20)\d\d/\d\d/\d\d))\x20\((?!(MON|TUE|WED|THU|FRI|SAT|SUN))" RSTI

      Note: (?: is for a non-capturing group

      Example:

      05/12/1995 (Fri) <-- This should not match
      05/13/1995 (Sat) <-- This should not match
      05/14/1995 (zzzday) <-- This should not match
      05/15/1995 (Mox) <-- ***This should match***
      05/16/1995 (Tue) <-- This should not match
      05/17/2005 (Tue) <-- This should not match

      I did get the clip working using the above FIND and a few extra lines, but now I'd like to know if this is (easily)
      possible to do with one FIND.

      Thanks!

      Joy



      [Non-text portions of this message have been removed]
    • Show all 13 messages in this topic