用于检测Zalgo的正则表达式

问题描述 投票:0回答:1

我正在创建一个邮件过滤系统,该系统可以检测到z͎͗ͣḁ̵̑l̉̃ͦg̐̓̒o͓̔ͥ。

我当前的正则表达式为/([^\u0009-\u02b7\u2000-\u20bf\u2122\u0308]|(?![^aeiouy])\u0308)/gm但这也会捕获表情符号。

regex应该过滤所有w̵̢̃ë̸̩́ị̵̽r̴̺̆d̴̘̕t̴͎́e̷̳̅x̷̷́ṱ̸̏l̸̜͒i̶̧͐k̸̗̈ě̸͖t̶̛̤h̸̰̔i̵̿͜ş̴̛或t̶e̶x̴t̸l̸i̶k̶e̸t̵h̷i̷s̴,但不应捕获表情符号。 🤔

javascript regex string regular-language zalgo
1个回答
2
投票

console.log( decodeURIComponent( encodeURIComponent("w̵̢̃ë̸̩́ị̵̽r̴̺̆d̴̘̕ ̴͎́ẗ̷͕́e̷̳̅x̷̮́ṱ̸̏ ̸̜͒ḻ̵̎i̶̧͐k̸̗̈ě̸͖ ̸̥̄t̶̛̤h̸̰̔i̵̿͜ş̴̛ 🤔") .replace(/%CC(%[A-Z0-9]{2})+(\w|%20)/g,"$2") ) )
© www.soinside.com 2019 - 2024. All rights reserved.