Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Balanced delimiter parsing

by I0 (Priest)
on Oct 06, 2002 at 06:43 UTC ( [id://203141] : note . print w/replies, xml ) Need Help??


in reply to Balanced delimiter parsing

Using only regexps
$_="...<value>...<value>...</value>...</value>..."; ($re=$_)=~s#((<value>)|(</value>)|.)#${[')','']}[!$3]\Q$1\E${['(','']} +[!$2]#gs; print join "\n",eval{/$re/}; die $@ if $@=~/unmatched/i;