首页 > 技术文章 > 中文正则表达式

zacxu 2018-12-14 12:00 原文

[\u4e00-\u9fa5]

 

example:

// replace Chinese char with "**"
var textLength = text.replace(/[\u4e00-\u9fa5]/g,"**").length;

推荐阅读