diff options
author | David M <davidmj@users.sourceforge.net> | 2006-12-23 17:56:50 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2006-12-23 17:56:50 +0000 |
commit | c0f64d360fcb410192fa35d6353a2956bcc421c6 (patch) | |
tree | ee80c1dfca7eb3e683ddfa7a6f59e48ce43b513d | |
parent | 6d0a00a446396ab72d8fb0475f4cd1c8ab9fa151 (diff) | |
download | forums-c0f64d360fcb410192fa35d6353a2956bcc421c6.tar forums-c0f64d360fcb410192fa35d6353a2956bcc421c6.tar.gz forums-c0f64d360fcb410192fa35d6353a2956bcc421c6.tar.bz2 forums-c0f64d360fcb410192fa35d6353a2956bcc421c6.tar.xz forums-c0f64d360fcb410192fa35d6353a2956bcc421c6.zip |
regex man strikes again!
git-svn-id: file:///svn/phpbb/trunk@6794 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/develop/regex.php | 9 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 8 |
2 files changed, 8 insertions, 9 deletions
diff --git a/phpBB/develop/regex.php b/phpBB/develop/regex.php index 4893a3d271..2b736afec2 100644 --- a/phpBB/develop/regex.php +++ b/phpBB/develop/regex.php @@ -43,12 +43,11 @@ echo 'IPv4: ' . $ipv4 . "<br />\nIPv6: " . $ipv6 . "<br />\n"; $pct_encoded = "%[\dA-F]{2}"; $unreserved = 'a-z0-9\-._~'; $sub_delims = '!$&\'()*+,;='; -$pchar = "(?:[$unreserved$sub_delims:@|]|$pct_encoded)"; // rfc: no "|" +$pchar = "(?:[$unreserved$sub_delims:@|]+|$pct_encoded)"; // rfc: no "|" $scheme = '[a-z][a-z\d+\-.]*'; -$reg_name = "(?:[$unreserved$sub_delims|]|$pct_encoded)+"; // rfc: * instead of + and no "|" -$authority = "(?:(?:[\w\-.~!$&'()*+,;=:]|$pct_encoded)*@){0,1}(?:$reg_name|$ipv4|\[$ipv6\])[:]?\d*"; -$userinfo = "(?:(?:[$unreserved$sub_delims:]|$pct_encoded))*"; +$reg_name = "(?:[$unreserved$sub_delims|]+|$pct_encoded)+"; // rfc: * instead of + and no "|" +$userinfo = "(?:(?:[$unreserved$sub_delims:]+|$pct_encoded))*"; $ipv4_simple = '[0-9.]+'; $ipv6_simple = '\[[a-z0-9.:]+\]'; $host = "(?:$reg_name|$ipv4_simple|$ipv6_simple)"; @@ -57,7 +56,7 @@ $authority = "(?:$userinfo@)?$host(?::$port)?"; $segment = "$pchar*"; $path_abempty = "(?:/$segment)*"; $hier_part = "/{2}$authority$path_abempty"; -$query = "(?:[$unreserved$sub_delims:@/?|]|$pct_encoded)*"; // pchar | "/" | "?", rfc: no "|" +$query = "(?:[$unreserved$sub_delims:@/?|]+|$pct_encoded)*"; // pchar | "/" | "?", rfc: no "|" $fragment = $query; $url = "$scheme:$hier_part(?:\?$query)?(?:\#$fragment)?"; diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ea05d969a2..323590b269 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2740,7 +2740,7 @@ function get_preg_expression($mode) case 'bbcode_htm': return array( '#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#', - '#<!\-\- (l|m|w) \-\-><a href="(.*?)">.*?</a><!\-\- \1 \-\->#', + '#<!\-\- ([lmw]) \-\-><a href="(.*?)">.*?</a><!\-\- \1 \-\->#', '#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '#<!\-\- .*? \-\->#s', '#<.*?>#s', @@ -2749,15 +2749,15 @@ function get_preg_expression($mode) case 'url': // generated with regex generation file in the develop folder - return "[a-z][a-z\d+\-.]*:/{2}(?:(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[\dA-F]{2}))*@)?(?:(?:[a-z0-9\-._~!$&'()*+,;=|]|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.:]+\])(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'()*+,;=:@|]|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]|%[\dA-F]{2})*)?"; + return "[a-z][a-z\d+\-.]*:/{2}(?:(?:(?:[a-z0-9\-._~!$&'()*+,;=:]+|%[\dA-F]{2}))*@)?(?:(?:[a-z0-9\-._~!$&'()*+,;=|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.:]+\])(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; break; case 'www_url': - return "www\.(?:[a-z0-9\-._~!$&'()*+,;=|]|%[\dA-F]{2})+(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'()*+,;=:@|]|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]|%[\dA-F]{2})*)?"; + return "www\.(?:[a-z0-9\-._~!$&'()*+,;=|]+|%[\dA-F]{2})+(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; break; case 'relative_url': - return "(?:[a-z0-9\-._~!$&'()*+,;=:@|]|%[\dA-F]{2})*(?:/(?:[a-z0-9\-._~!$&'()*+,;=:@|]|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]|%[\dA-F]{2})*)?"; + return "(?:[a-z0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*(?:/(?:[a-z0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; break; } |