js 正则表达式 取反

http://www.w3school.com.cn/jsref/jsref_obj_regexp.asp

以匹配中文为例

const test_value = '李钊鸿'

if (/[^u4e00-u9fa5]/.test(test_value)) {
      return console.log('请输入中文汉字')
} else {
      return console.log("合法中文汉字");
}
原文地址:https://www.cnblogs.com/CyLee/p/7891199.html