1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Slightly loosen the mention regexp to allow for "Go ask @tomo."

Summary: Currently, we incorrectly flag these under the "@lists.com" rule.
Test Plan:
https://secure.phabricator.com/file/view/PHID-FILE-887c2bc66eb9d47d02f4/
Reviewed By: tomo
Reviewers: tomo
CC: aran, epriestley, tomo
Differential Revision: 708
This commit is contained in:
epriestley 2011-07-21 16:26:51 -07:00
parent ef89340aa9
commit ffae7b19e6

View file

@ -29,8 +29,9 @@ class PhabricatorRemarkupRuleMention
// NOTE: Negative lookahead for period prevents us from picking up email
// addresses, while allowing constructs like "@tomo, lol". The negative
// lookbehind for a word character prevents us from matching "mail@lists"
// while allowing "@tomo/@mroch".
$regexp = '/(?<!\w)@([a-zA-Z0-9]+)\b(?![.])/';
// while allowing "@tomo/@mroch". The negative lookahead prevents us from
// matching "@joe.com" while allowing us to match "hey, @joe.".
$regexp = '/(?<!\w)@([a-zA-Z0-9]+)\b(?![.]\w)/';
$matches = null;
$ok = preg_match_all($regexp, $text, $matches);