<?xml version="1.0" encoding="windows-1252"?>
<node id="941957" title="Re: regex: negative lookahead" created="2011-12-06 00:01:46" updated="2011-12-06 00:01:46">
<type id="11">
note</type>
<author id="869435">
vinian</author>
<data>
<field name="doctext">
&lt;p&gt;
i don't think there is something to do with regex negative lookahead,  the problem lies in the &lt;br /&gt;&lt;c&gt;(\w+(,\s)?)+&lt;/c&gt;&lt;br /&gt;
 it will match "INFO, FILE, SYSLOG", but not "INFO, FILE".&lt;br /&gt;  "+" is greedy,  it eaten whatever match by  "( ... )" .  I don't how to make the above regex match less, but i use this &lt;br /&gt;&lt;c&gt;print "has_matched $has\n"    if $has   =~ /^($start(\w+(,\s)?)+?)$(?&lt;!$end)/;&lt;/c&gt;&lt;br /&gt; and it will not match &lt;c&gt;$has&lt;/c&gt;.  
&lt;/p&gt;</field>
<field name="root_node">
941881</field>
<field name="parent_node">
941881</field>
</data>
</node>
