删除标点符号

// https://stackoverflow.com/questions/21109011/javascript-unicode-string-chinese-character-but-no-punctuation
// 删除标点符号
console.log(
    "hello! 42 我的中文不好。我是意大利人。你知道吗?"
        .split("")
        .filter(char => /\p{Script=Han}/u.test(char))
        .join("")
);
posted @ 2022-01-12 20:25  程序媛李李李李蕾  阅读(79)  评论(0编辑  收藏  举报