fix: improved url regex

This commit is contained in:
Zoe Martin 2021-06-25 15:14:30 +02:00
parent e9da1a80b7
commit 131ee8d87c
No known key found for this signature in database
GPG Key ID: 65238C3E138FFBE9

View File

@ -186,7 +186,7 @@ namespace PluralKit.Bot
} }
var endsWithUrl = Regex.IsMatch(msg, var endsWithUrl = Regex.IsMatch(msg,
@"(http|https)?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$"); @"(http|https)(:\/\/)?(www\.)?([-a-zA-Z0-9@:%._\+~#=]{1,256})?\.?([a-zA-Z0-9()]{1,6})?\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$");
if (endsWithUrl) if (endsWithUrl)
{ {
var urlTail = repliedTo.Content.Substring(100).Split(" ")[0]; var urlTail = repliedTo.Content.Substring(100).Split(" ")[0];