SyntaxFix
Write A Post
Hire A Developer
Questions
This works just as well: http://jsfiddle.net/maniator/ge59E/3/
var reg = new RegExp(" ","g"); //<< just look for a space.