while($xml=~m/\<(.+?)(\s.*?)?\>(.+?)\<\/\1\>/sig){
and then $2 is your attributes and $3 is your element body.
You also might consider one of the various XML parsing modules available from CPAN like XML::Simple for instance. Robust XML parsing is not simple - there are just so many details that can trip you up.
In reply to Re: Regular expression - parsing and xml string
by pc88mxer
in thread Regular expression - parsing and xml string
by slloyd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |