mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 评论区优先匹配更长的正则
避免【@植物大战僵尸 @植物大战僵尸2】同时出现时只识别到前者
This commit is contained in:
@@ -575,7 +575,7 @@ InlineSpan buildContent(
|
|||||||
return e.replaceAllMapped(
|
return e.replaceAllMapped(
|
||||||
RegExp(r'[?+*]'), (match) => '\\${match.group(0)}');
|
RegExp(r'[?+*]'), (match) => '\\${match.group(0)}');
|
||||||
}).toList();
|
}).toList();
|
||||||
|
specialTokens.sort((a, b) => b.length.compareTo(a.length));
|
||||||
String patternStr = specialTokens.map(RegExp.escape).join('|');
|
String patternStr = specialTokens.map(RegExp.escape).join('|');
|
||||||
if (patternStr.isNotEmpty) {
|
if (patternStr.isNotEmpty) {
|
||||||
patternStr += "|";
|
patternStr += "|";
|
||||||
|
|||||||
Reference in New Issue
Block a user