my $input = '123+45'; my $output = ''; for ($input) { /\G ( \+ ) /xgc && do { $output .= " $1 "; redo }; /\G ( . ) /xgcs && do { $output .= $1; redo }; } print("$output\n");
<hint>If only Perl had a substitution operator, this parser wouldn't be needed...</hint>
In reply to Re^2: Reg exprs
by ikegami
in thread Reg exprs
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |