s/(?<=\s)(\s+)/' ' x length($1)/eg
You don't need to bother with the length and /e: just substituting one space at a time and letting the /g flag take care of the repetition works fine:
s/(?<=\s)\s/ /gSmylers
In reply to Re^2: Converting multiple spaces to nbsp
by Smylers
in thread Converting multiple spaces to nbsp
by eastcoastcoder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |