My first PerlMonks node provided a solution to a problem very like this one. If you twiddle the values in the quantifier and remove the /g switch then you have the solution you are probably looking for.
See perlretut, perlre and perlreref for more regular expression goodness.
In reply to Re: How to split a string into two lines, intelligently
by GrandFather
in thread How to split a string into two lines, intelligently
by kweise
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |