Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

regex is empty string javascript

const REGEXP = /^$/;

const validate = (text) => {
    return REGEXP.test(text);
}

const isEmpty = validate("");
const isNotEmpty = validate("x");

console.log(isEmpty); //true
console.log(isNotEmpty); //false
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #regex #empty #string #javascript
ADD COMMENT
Topic
Name
3+9 =