improve link regex
This commit is contained in:
parent
b6a7c94293
commit
c7c85af6b4
2 changed files with 6 additions and 1 deletions
|
|
@ -19,6 +19,11 @@ const zeroWidthEmotes = [
|
|||
/// Regex for matching strings that contain lower or upper case English characters.
|
||||
final regexEnglish = RegExp(r'[a-zA-Z]');
|
||||
|
||||
final regexLink = RegExp(
|
||||
r'(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/\/=]*)',
|
||||
caseSensitive: false, // Make it case-insensitive
|
||||
);
|
||||
|
||||
/// The default badge width and height.
|
||||
const defaultBadgeSize = 18.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -694,7 +694,7 @@ class IRCMessage {
|
|||
}
|
||||
},
|
||||
);
|
||||
} else if (RegExp(r'https?:\/\/').hasMatch(text)) {
|
||||
} else if (regexLink.hasMatch(text)) {
|
||||
return TextSpan(
|
||||
text: text,
|
||||
style: style?.copyWith(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue