From 4feb8a26c697aa7e474a855210b41577ecb83138 Mon Sep 17 00:00:00 2001 From: Hxphieno <114409992+hxphieno@users.noreply.github.com> Date: Sun, 14 Apr 2024 02:15:45 +0800 Subject: [PATCH] [fix] some urls will be misjudged to phone (#16) --- lib/src/utils/regex.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/utils/regex.dart b/lib/src/utils/regex.dart index 97e180b..21452ab 100644 --- a/lib/src/utils/regex.dart +++ b/lib/src/utils/regex.dart @@ -59,13 +59,13 @@ LinkType getMatchedType(String match) { late LinkType type; if (RegExp(emailRegExp).hasMatch(match)) { type = LinkType.email; - } else if (RegExp(phoneRegExp).hasMatch(match)) { + } else if (RegExp(urlRegExp).hasMatch(match)) { + type = LinkType.url; + }else if (RegExp(phoneRegExp).hasMatch(match)) { type = LinkType.phone; } else if (RegExp(userTagRegExp).hasMatch(match)) { type = LinkType.userTag; - } else if (RegExp(urlRegExp).hasMatch(match)) { - type = LinkType.url; - } else if (RegExp(hashtagRegExp).hasMatch(match)) { + } else if (RegExp(hashtagRegExp).hasMatch(match)) { type = LinkType.hashTag; } return type;