i don't think there is something to do with regex negative lookahead, the problem lies in the
(\w+(,\s)?)+
it will match "INFO, FILE, SYSLOG", but not "INFO, FILE".
"+" is greedy, it eaten whatever match by "( ... )" . I don't how to make the above regex match less, but i use this
print "has_matched $has\n" if $has =~ /^($start(\w+(,\s)?)+?)$(?<!$end)/;
and it will not match $has.
In reply to Re: regex: negative lookahead
by vinian
in thread regex: negative lookahead
by svenXY
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |