Merge pull request #536 from KoolShow/fix_seekto_regexp

fix: 含有小时的时间无法跳转
This commit is contained in:
guozhigq
2024-02-12 18:11:26 +08:00
committed by GitHub

View File

@ -588,7 +588,7 @@ InlineSpan buildContent(
if (patternStr.isNotEmpty) { if (patternStr.isNotEmpty) {
patternStr += "|"; patternStr += "|";
} }
patternStr += r'(\b\d{1,2}[:]\d{2}(?:[:]\d{2})?\b)'; patternStr += r'(\b(?:\d+[:])?[0-5]?[0-9][:][0-5]?[0-9]\b)';
final RegExp pattern = RegExp(patternStr); final RegExp pattern = RegExp(patternStr);
List<String> matchedStrs = []; List<String> matchedStrs = [];
void addPlainTextSpan(str) { void addPlainTextSpan(str) {
@ -636,8 +636,8 @@ InlineSpan buildContent(
}, },
), ),
); );
} else if (RegExp(r'^\b\d{1,2}[:]\d{2}(?:[:]\d{2})?\b$')
.hasMatch(matchStr)) { } else if (RegExp(r'^\b(?:\d+[:])?[0-5]?[0-9][:][0-5]?[0-9]\b$').hasMatch(matchStr)) {
matchStr = matchStr.replaceAll('', ':'); matchStr = matchStr.replaceAll('', ':');
spanChilds.add( spanChilds.add(
TextSpan( TextSpan(