diff --git a/src/applications/maniphest/field/parser/__tests__/ManiphestCustomFieldStatusParserTestCase.php b/src/applications/maniphest/field/parser/__tests__/ManiphestCustomFieldStatusParserTestCase.php --- a/src/applications/maniphest/field/parser/__tests__/ManiphestCustomFieldStatusParserTestCase.php +++ b/src/applications/maniphest/field/parser/__tests__/ManiphestCustomFieldStatusParserTestCase.php @@ -60,6 +60,16 @@ 'offset' => 0, ), ), + 'Fixes T123, T456, and T789.' => array( + array( + 'match' => 'Fixes T123, T456, and T789', + 'prefix' => 'Fixes', + 'infix' => '', + 'monograms' => array('T123', 'T456', 'T789'), + 'suffix' => '', + 'offset' => 0, + ), + ), ); foreach ($map as $input => $expect) { 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 @@ -25,6 +25,7 @@ $prefix_regex. $infix_regex. '((?:'.$monogram_pattern.'[,\s]*)+)'. + '(?:\band\s+('.$monogram_pattern.'))?'. $suffix_regex. '(?:$|\b)'. '/'; @@ -42,12 +43,18 @@ $results = array(); foreach ($matches as $set) { + $monograms = array_filter(preg_split('/[,\s]+/', $set[3][0])); + + if (isset($set[4]) && $set[4][0]) { + $monograms[] = $set[4][0]; + } + $results[] = array( 'match' => $set[0][0], 'prefix' => $set[1][0], 'infix' => $set[2][0], - 'monograms' => array_filter(preg_split('/[,\s]+/', $set[3][0])), - 'suffix' => idx(idx($set, 4, array()), 0, ''), + 'monograms' => $monograms, + 'suffix' => idx(idx($set, 5, array()), 0, ''), 'offset' => $set[0][1], ); }