in reply to Re: regex find and replace with a twist
in thread regex find and replace with a twist

I think a split-based solution (which I personally would not use) would have to look something like this to get what seems (I think) to be the required output:

c:\@Work\Perl\monks>perl -wMstrict -le "my $word = '$-.%aBc&/'; my $new_word = join '', map { /[[:alpha:]]/ ? qq{[$_]} : $_ } split '', $word ; print qq{'$word' -> '$new_word'}; " '$-.%aBc&/' -> '$-.%[a][B][c]&/'
Since this depends on two regexes, I think you might as well use a  s/// approach and be done with it.


Give a man a fish:  <%-{-{-{-<