fix unescaped dash in regular expression

This commit is contained in:
Ralf Becker 2019-06-14 17:19:52 +02:00
parent fd9415dc58
commit 6f1590fcaf

View File

@ -61,7 +61,7 @@ class Html
{
// First match things beginning with http:// (or other protocols)
$Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))'; // only http:// gets removed, other protocolls are shown
$Domain = '([\w-]+\.[\w-.]+)';
$Domain = '([\w-]+\.[\w\-.]+)';
$Subdir = '([\w\-\.,@?^=%&;:\/~\+#]*[\w\-\@?^=%&\/~\+#])?';
$optStuff = '("|&quot|;)?';
$Expr = '/' . $NotAnchor . $Protocol . $Domain . $Subdir . $optStuff . '/i';
@ -92,7 +92,7 @@ class Html
// Now match things beginning with www.
$optBracket0 = '(<|&lt;)?';
$NotHTTP = '(?<!:\/\/|" target=\"_blank\">)'; // avoid running again on http://www links already handled above
$Domain2 = 'www(\.[\w-.]+)';
$Domain2 = 'www(\.[\w\-.]+)';
$Subdir2 = '([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?';
$optBracket = '(>|&gt;|&gt|;)?';
$Expr = '/' .$optBracket0. $NotAnchor . $NotHTTP . $Domain2 . $Subdir2 .$optBracket. '/i';