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