Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

regex is not empty string

const REGEXP = /^$/;

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

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

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