Skip to main content
added 119 characters in body; added 39 characters in body
Source Link
Paul Creasey
  • 28.9k
  • 10
  • 59
  • 91
if (/^\s+$/.test(myString))
{
      //string contains only whitespace
}

this checks for 1 or more whitespace characters, if you it to also match an empty string then replace + with *.

if (/^\s+$/.test(myString))
{

}
if (/^\s+$/.test(myString))
{
      //string contains only whitespace
}

this checks for 1 or more whitespace characters, if you it to also match an empty string then replace + with *.

Source Link
Paul Creasey
  • 28.9k
  • 10
  • 59
  • 91

if (/^\s+$/.test(myString))
{

}