Lookbehind has to be a fixed width; yours isn't (the + quantifier) so it's an invalid regex.
This is a little kludgy, but will work:
my $str = "123456789"; $str = reverse $str; $str =~ s/(?<=\d)(?=(\d\d)+$)/-/g; $str = reverse $str; print $str, "\n";
In reply to Re: Another puzzled RegEx Problem.
by Fletch
in thread Another puzzled RegEx Problem.
by pysome
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |