This ([a-z0-9]* ) will only match lowercase letters. The capital W will not be matched. Thus only B-ab6142 will match. Use Pattern: ([A-Z]-)(?![a-z]{3})([a-zA-Z0-9]* ) If you want it to match the C- pattern as well.
-Peter
-----Original Message----- From: Arian Hojat - armyofda12mnkeys@gmail.com [mailto:+recoach+pbowers+7ef1bd310e.armyofda12mnkeys#gmail.com @spamgourmet.com] Sent: Tuesday, May 20, 2008 5:44 PM To: regex-coach@common-lisp.net Subject: [regex-coach] negative lookahead assertion bug? (recoach: message 7 of 20)
Hello all,
had a question/possible bug report... For the example on this webpage: http://www.nuclearblender.com/leftovers/howto/regex/
this pattern is presented and i tried a positive lookup assertion which worked, but this first negative one only matched the first pattern (global option is on btw, so not sure why wont match). Pattern: ([A-Z]-)(?![a-z]{3})([a-z0-9]* ) Text to lookup: A-xyz37 # B-ab6142 # C-Wxy66 # D-qrs93
Should match B-ab6142 and C-Wxy66 as they both (have a capital letter followed by a dash), then (dont have 3 lower case letters), and (are following by letters/numbers and a space) only matches first one in the program.
Thanks, let me know if it should match only one if im wrong. Running latest version on Windows XP. Great Tool! Arian