📜  正则表达式是空字符串 javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:54.402000             🧑  作者: Mango

代码示例2
const REGEXP = /^$/;

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

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

console.log(isEmpty); //true
console.log(isNotEmpty); //false