showing results for - "regex for check if string is only empty or whitespace javascript"
Electra
11 Jan 2021
1function IsEmptyOrWhiteSpace(str) {
2    return (str.match(/^\s*$/) || []).length > 0;
3}
Alice
11 Jul 2020
1//empty string or white space
2function hasWhiteSpace(value) {
3  return /^\s*$/.test(value);
4}
5
6// empty string or string with white space 
7function hasWhiteSpace(value) {
8  return /^$|\s+/.test(value);
9 }
queries leading to this page
check if a string contains characters is empty space javascriptreg should not match empty string in jsmatch an empty string jsjs regex empty strigngtypscirptcheck if string is emptyregular expression for empty string in javascriptregex non empty string javascriptjs test if string is emptyvalidate if a string is not empty javascriptjavascript empty regexcheck empty string javascript with regexregex is empty string javascriptjavascript regex check if string is emptyregex javascript not emptyempty string regex javascriptjavascript regex for empty stringmatch string regex javascript and empty valuecheck if js string is emptyjavascript not empty or null regexcheck if string is empty jsjavascript check if string is emptyregex for check if string is only empty or whitespace javascriptjs best way to check if string is emptyregular expression for null or empty string javascriptregular expression test to check empty string in javascriptjs check if string isnt empty and not indentingjs check if a string is emptyregex for empty string javascriptdetect whitespace javascript regexregex for empty space javascripthow to detect if string is empty javascriptjs regex match empty stringjavascript regex test whitespace onlyjs regex empty stringregex for is empty string jsregex to check empty string javascriptjs check for empty regexjavascript check if string is not empty or whitespacecheck if string is empty in jsjavascript regex if line is completely empty using regular expression to check for empty string in javascriptcheck if js string is not only whitespacejs check if string is not emptyjavascript regex invalidates empty stringjs match empty string at the endregex for empty string in jsregex not empty string javascriptempty regex javascriptjavascript regex to check empty stringjs check if string is emptyjavascript regular expression empty stringjavascript check if string is not null or whitespacejavascript regex allow empty stringjs empty regexjs regex should be not emptyjavascript regex empty stringhow to check the empty string with regex in javascriptregex for check if string is only empty or whitespace javascript