Skip to content

Commit 4d78d4a

Browse files
Merge pull request #63 from toastbrotch/patch-1
fix #59 (allow numbers in jira project name)
2 parents 0760945 + 8c8d308 commit 4d78d4a

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/main/java/se/gustavkarlsson/rocketchat/jira_trigger/routes/JiraKeyParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import static se.gustavkarlsson.rocketchat.jira_trigger.routes.IssueDetail.NORMAL;
1414

1515
class JiraKeyParser {
16-
private static final Pattern JIRA_KEY = Pattern.compile("[A-Z]+-\\d+\\+?");
16+
private static final Pattern JIRA_KEY = Pattern.compile("[A-Z][A-Z0-9]+-\\d+\\+?");
1717
private static final Set<Character> ALWAYS_VALID = new HashSet<>(Arrays.asList(' ', '\t', '\n'));
1818

1919
private final Set<Character> whitelistedPrefixes;

src/test/java/se/gustavkarlsson/rocketchat/jira_trigger/routes/JiraKeyParserTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ public ValidJiraKeys(String text) {
3939
@Parameters(name = "{0}")
4040
public static Collection<Object[]> data() {
4141
return Arrays.asList(new Object[][]{
42-
{"A-1"},
4342
{"AB-1"},
44-
{"A-999999999"},
4543
{"AAAAAAAAAA-1"},
4644
{"ZZZZZZZZZZ-9999999999"},
4745
{"Lets try ABC-123"},
4846
{"ABC-123 is a good one"},
4947
{"\nABC-123\n"},
5048
{"\tABC-123\t"},
51-
{" ABC-123 "}
49+
{" ABC-123 "},
50+
{"A1BC3-123"},
51+
{"AB3-123"}
5252
});
5353
}
5454

@@ -86,7 +86,10 @@ public static Collection<Object[]> data() {
8686
{"abc-123"},
8787
{"ABC-123Z"},
8888
{"(ABC-123)"},
89-
{"browse/ABC-123"}
89+
{"browse/ABC-123"},
90+
{"3BC-23"},
91+
{"A-999999999"},
92+
{"A-1"},
9093
});
9194
}
9295

0 commit comments

Comments
 (0)