$x=0; $in=0; $string =~ s#(")?([^" ]+)(")?# if ($in) { print $2; if ($3) { print "\n"; $in=0; } else { print " "; } } else { print "[".$x++."] $2"; if ($in=$1) { print " ";} else { print "\n"; } } #egx;
Could be more compact probably, but I left it "apart" for easier viewing. :)
In reply to Re: Another for those who love the Regular Expression questions...
by turnstep
in thread Another for those who love the Regular Expression questions...
by Hot Pastrami
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |