mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-25 06:50: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:
parent
61f2ba5c47
commit
cce786a89f
1 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue