You could use a negative look-ahead to replace any space that is not followed by a space with nothing. This will break down if there are more than two spaces though.
knoppix@Microknoppix:~$ perl -E ' > $dateStr = q{ 2 0 1 2 - 7 - 2 7 9 : 3 7 : 3 1 }; > $dateStr =~ s{\s(?!\s)}{}g; > say $dateStr;' 2012-7-27 9:37:31 knoppix@Microknoppix:~$
Cheers,
JohnGG
In reply to Re: Removing extra spaces
by johngg
in thread Removing extra spaces
by rickoy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |