Seems pretty simple, but cannot figure out why this javascript code isn\'t working returning false, when expecting true) - I\'m guessing it has got to do something with the esca
You need a double escape character:
one for the "s" and one for the "\" itself:
var inValid = new RegExp("[\\s]");