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

js 正则表达式 取反

 

以匹配中文为例

const test_value = '李钊鸿'

if (/[^\u4e00-\u9fa5]/.test(test_value)) {
      return console.log('请输入中文汉字')
} else {
      return console.log("合法中文汉字");
}

 

相关文章:

  • 2021-12-15
  • 2022-01-08
  • 2021-08-01
  • 2021-07-15
猜你喜欢
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
相关资源
相似解决方案