in reply to When a regexp with /g needs to be run .. twice

$foo = ':{"'; $foo =~ s/([:,{])(.)/$1 $2/g; print "'$foo'\n";

If you just want a space after each of those, but not if it's the last char in a string:

1 while $foo =~ s/([:,{])([^ ])/$1 $2/g; # [^ ] is "not space"

If you want it after the last char in a string, you'll need something like:

1 while $foo =~ s/([:,{])([^ ]|$)/$1 $2/g;

Quantum Mechanics: The dreams stuff is made of