Unicodize a couple regexes for tags: fixes linking & detection of non-ASCII tags that match the current regexes.

(Checks for 'letter' and 'number' characters, underscore, dash, and period.)
This commit is contained in:
Brion Vibber 2011-02-23 16:37:55 -08:00
parent 1be2226019
commit 295e2bde56
2 changed files with 2 additions and 2 deletions

View File

@ -153,7 +153,7 @@ class Notice extends Memcached_DataObject
function saveTags()
{
/* extract all #hastags */
$count = preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/', strtolower($this->content), $match);
$count = preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/u', strtolower($this->content), $match);
if (!$count) {
return true;
}

View File

@ -784,7 +784,7 @@ function common_render_text($text)
$r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r);
$r = common_replace_urls_callback($r, 'common_linkify');
$r = preg_replace('/(^|\&quot\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r);
$r = preg_replace('/(^|\&quot\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/ue', "'\\1#'.common_tag_link('\\2')", $r);
// XXX: machine tags
return $r;
}