It should be the same, regardless of the language.. however, according to
http://www.webreference.com/js/column5/ javascript's regexp's were created based on perl's regexp.
neo is right that \s will match whitespace.. the only thing missing is the fact that you asked for a regexp that would match a string that consists ONLY of whitespace, which means that the start/end line boundary's will need to be used. I'm not super familar with javascript, but here is my attempt:
Code:
function isWhiteSpacel(myString)_
{
var inString = myString.match(/^\s*$/);
if (inString) {
alert("string '"+ myString + "' contains only whitespace")
}
}
Note that I used * instead of +, as neo suggested... this + means one or more, and * means zero or more, so this version will match even a blank string. I use something similar when parsing config files in perl.