<?xml version="1.0" encoding="windows-1252"?>
<node id="988427" title="Re: Regex match last" created="2012-08-20 06:38:58" updated="2012-08-20 06:38:58">
<type id="11">
note</type>
<author id="352046">
ww</author>
<data>
<field name="doctext">
&lt;p&gt;Alternate:&lt;/p&gt;

&lt;c&gt;C:\&gt;perl -E "my $str='&lt;c:t="AD2343"/&gt;&lt;c:p&gt;65677676&lt;/c:p&gt;'; if ( $str =~ m|(&lt;c:.*)?(?:[/&gt;]{2})| ) {say $1;}"
&lt;c:t=AD2343&lt;/c&gt;

&lt;p&gt;Your code asks the regex engine to match a 'c', a colon and &lt;b&gt;any number of anything thereafter&lt;/b&gt;(except newlines).&lt;/p&gt;

&lt;p&gt;Because you didn't provide the actual code, we can't be sure just what other issues may be in play... such as the previously mentioned use of an alternate regex marker.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update (based on the redefined problem in  [id://988425]): &lt;/b&gt; You'll probably have fewer problems in the long run if you use an html parser of one flavor or another, rather than trying to parse html with regexen.&lt;/p&gt;</field>
<field name="root_node">
988422</field>
<field name="parent_node">
988422</field>
</data>
</node>
