🐛 Fix link expand match markdown link

This commit is contained in:
LittleSheep 2024-08-21 10:06:05 +08:00
parent 221b97901f
commit cc1e0599aa

View File

@ -24,10 +24,7 @@ class LinkExpansion extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final linkRegex = RegExp( final linkRegex = RegExp(
r'(?:(?:https?|ftp):\/\/|www\.)' r'(?<!\()(?:(?:https?):\/\/|www\.)(?:[-_a-z0-9]+\.)*(?:[-a-z0-9]+\.[-a-z0-9]+)[^\s<]*[^\s<?!.,:*_~]',
r'(?:[-_a-z0-9]+\.)*(?:[-a-z0-9]+\.[-a-z0-9]+)'
r'[^\s<]*'
r'[^\s<?!.,:*_~]',
); );
final matches = linkRegex.allMatches(content); final matches = linkRegex.allMatches(content);
if (matches.isEmpty) { if (matches.isEmpty) {