1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 22:40:55 +01:00

Prevent mentions from matching "derp@derp"

Summary: See task / comment.
Test Plan:
https://secure.phabricator.com/file/view/PHID-FILE-f337d112ffe053fdea7d/
Reviewed By: tomo
Reviewers: mroch, tomo
CC: aran, tomo
Differential Revision: 614
This commit is contained in:
epriestley 2011-07-08 11:21:00 -07:00
parent 61f2ba5c47
commit cce786a89f

View file

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