diff --git a/src/applications/differential/parser/__tests__/DifferentialCustomFieldRevertsParserTestCase.php b/src/applications/differential/parser/__tests__/DifferentialCustomFieldRevertsParserTestCase.php --- a/src/applications/differential/parser/__tests__/DifferentialCustomFieldRevertsParserTestCase.php +++ b/src/applications/differential/parser/__tests__/DifferentialCustomFieldRevertsParserTestCase.php @@ -76,6 +76,9 @@ ), ), + // This tests a degenerate regex behavior, see T9268. + 'Reverts aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz' => array(), + "This doesn't revert anything" => array(), 'nonrevert of r11' => array(), 'fixed a bug' => array(), diff --git a/src/infrastructure/customfield/parser/PhabricatorCustomFieldMonogramParser.php b/src/infrastructure/customfield/parser/PhabricatorCustomFieldMonogramParser.php --- a/src/infrastructure/customfield/parser/PhabricatorCustomFieldMonogramParser.php +++ b/src/infrastructure/customfield/parser/PhabricatorCustomFieldMonogramParser.php @@ -24,8 +24,8 @@ '(?:^|\b)'. $prefix_regex. $infix_regex. - '((?:'.$monogram_pattern.'[,\s]*)+)'. - '(?:\band\s+('.$monogram_pattern.'))?'. + '((?:'.$monogram_pattern.'(?:\b|$)[,\s]*)+)'. + '(?:\band\s+('.$monogram_pattern.'(?:\b|$)))?'. $suffix_regex. '(?:$|\b)'. '/';