A simple solution would be replacing
(\w )\s*(\w)|\s+
With \1\2
.
This would replace the possible multiple whitespaces between two alphnum by a single one, and erase all the others. As it is it (obviously) doesn't account for spaces inside quotes and all "special cases" though.
See demo here.