📜  正则表达式空字符串 - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:35.158000             🧑  作者: Mango

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

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

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

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