537RE: [NTS] Can a Reg Exp handle 123 AND not a|b|c followed by x?
- May 9, 2012Since 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.
RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
From: firstname.lastname@example.org [mailto:email@example.com] On Behalf Of mycroftj
Sent: Wednesday, May 09, 2012 18:55
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
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.
[Non-text portions of this message have been removed]
- << Previous post in topic Next post in topic >>