Try this to match a string containing more than just spaces
/.*\S.*/
It means
/= delimiter
.*= zero or nothing more than a new line
\S= everything except spaces (new line, tab, space)
so that you get a match nothing but a new line + something not whitespace + nothing but a new line
, /.+/, 1 .