From fa2467e8fe2eedff49d2d0c68f1a4cd799c032a9 Mon Sep 17 00:00:00 2001 From: Paul Tarjan Date: Tue, 27 Mar 2012 22:23:16 -0700 Subject: [PATCH] Extract out regex from PhabricatorRemarkupRuleMention Summary: I'd like to use this regex elsewhere and copying and pasting is bad. Test Plan: none Reviewers: casey, epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D2038 --- .../mention/PhabricatorRemarkupRuleMention.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/infrastructure/markup/remarkup/markuprule/mention/PhabricatorRemarkupRuleMention.php b/src/infrastructure/markup/remarkup/markuprule/mention/PhabricatorRemarkupRuleMention.php index 474b276a19..278444c0f7 100644 --- a/src/infrastructure/markup/remarkup/markuprule/mention/PhabricatorRemarkupRuleMention.php +++ b/src/infrastructure/markup/remarkup/markuprule/mention/PhabricatorRemarkupRuleMention.php @@ -27,17 +27,17 @@ final class PhabricatorRemarkupRuleMention const KEY_MENTIONED = 'phabricator.mentioned-user-phids'; + + // 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". The negative lookahead prevents us from + // matching "@joe.com" while allowing us to match "hey, @joe.". + const REGEX = '/(?