in reply to Split with data keep

It is not completely clear what you wish to extract. This will extract the variable parts. It assumes a name value may not contain a double-quote. If that is not correct match on the quote and following tag, like the second half of the regex.
#!/usr/bin/perl use strict; use warnings; $_ = q|<a name="a name"></a><!--start-->some stuff<!--end-->| . q|<a name="Mae B Arthur"></a><!--start-->various text<!--end-->| . q|<a name="36561357542"></a><!--start-->What kind of #'s that<!--end +-->| . q|<a name="aafq0w4tyu89[ "></a><!--start-->aeo;utrq[134[ a<!--end--> +| ; while ( m|<a name="([^"]+?)"></a>(?:<!--start-->(.*?)(<!--end-->)+?)|s +gc ) { print "name: |$1|\n" . "art: |$2|\n\n"; } __DATA__ name: |a name| art: |some stuff| name: |Mae B Arthur| art: |various text| name: |36561357542| art: |What kind of #'s that| name: |aafq0w4tyu89[ | art: |aeo;utrq[134[ a|