From d5b016eeb4c65d694b6c71d3b2902ade7bd5c6ca Mon Sep 17 00:00:00 2001 From: xiplus Date: Fri, 15 Mar 2024 21:26:10 +0800 Subject: [PATCH] Fix regex --- src/util.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/util.js b/src/util.js index 6fdec07..9b5770e 100644 --- a/src/util.js +++ b/src/util.js @@ -97,14 +97,14 @@ function parseMailBody(text) { ...text.matchAll(/(?:(?:[帳账帐][戶户號号]|用[户戶]|使用[者著])(?:名[称稱]?)?)[是為为]?[::]?\s*"(?:User:)?([^#]*?)"/g), ...text.matchAll(/(?:(?:[帳账帐][戶户號号]|用[户戶]|使用[者著])(?:名[称稱]?)?)[是為为]?[::]?\s*“(?:User:)?([^#]*?)”/g), ...text.matchAll(/(?:(?:[帳账帐][戶户號号]|用[户戶]|使用[者著])(?:名[称稱]?)?)[是為为]?[::]?\s*【(?:User:)?([^#]*?)】/g), - ...text.matchAll(/(?:(?:[帳账帐][戶户號号]|用[户戶]|使用[者著])(?:名[称稱]?)?)[是為为]?[::]?\s*[\[[【「“]\s*(?:User:)?([^#]*?)\s*[\]]】」”]/g), - ...text.matchAll(/(?:(?:[帳账帐][戶户號号]|用[户戶]|使用[者著])(?:名[称稱]?)?)(?:[是為为::]|[是為为][::])\n?(?:User:)?([^\[\][]【】「」"“”::,、。;,\n#]+)[,、。;,.\n]/g), + ...text.matchAll(/(?:(?:[帳账帐][戶户號号]|用[户戶]|使用[者著])(?:名[称稱]?)?)[是為为]?[::]?\s*[\[[【「『“]\s*(?:User:)?([^#]*?)\s*[\]]】」』”]/g), + ...text.matchAll(/(?:(?:[帳账帐][戶户號号]|用[户戶]|使用[者著])(?:名[称稱]?)?)(?:[是為为::]|[是為为][::])\n?(?:User:)?([^\[\][]【】「『」』"“”::,、。;,\n#]+)[,、。;,.\n]/g), ...text.matchAll(/创建名为([^#]+?)的账户/g), ...text.matchAll(/来自维基百科用户“([^#]+?)”的电子邮件/g), - ...text.matchAll(/[为為][\[[【「](.+?)[\]]】」#]申[请請]IP/g), - ...text.matchAll(/(?:user ?(?:name|id)|account).{0,20} is\s*:?\s*([^\[\]"“”「」#]+?)[.,\n]/ig), + ...text.matchAll(/[为為][\[[【「『](.+?)[\]]】」』#]申[请請]IP/g), + ...text.matchAll(/(?:user ?(?:name|id)|account).{0,20} is\s*:?\s*([^\[\]"“”「『」』#]+?)[.,\n]/ig), ...text.matchAll(/(?:user ?(?:name|id)|account).{0,20} is \[([^\[\]#]+?)\]/ig), - ...text.matchAll(/(?:user ?(?:name|id)|account).{0,20} is ["“「]([^\[\]"#]+?)["”」]/ig), + ...text.matchAll(/(?:user ?(?:name|id)|account).{0,20} is ["“「『]([^\[\]"#]+?)["”」』]/ig), ...text.matchAll(/(?:user ?(?:name|id)|account).{0,20}[::] ?([^,.,。;\n#]+?)[.,,。;\n]/ig), ].sort((a, b) => b.index - a.index); for (var match of matches) { @@ -128,7 +128,7 @@ function parseMailBody(text) { var matches = [ ...text.matchAll(/((?:\d{1,3}\.){3}\d{1,3})/g), ...text.matchAll(/((?:[0-9A-Fa-f:]+:+)+(?:[0-9A-Fa-f]+)?)/ig), - ...text.matchAll(/(#[1-4]\d{5})/g), + ...text.matchAll(/(#[1-5]\d{5})/g), ].sort((a, b) => b.index - a.index); for (var match of matches) { // extra test for ipv6