File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 38
38
MentionPattern = regexp .MustCompile (`(\s|^|\W)@[0-9a-zA-Z-_\.]+` )
39
39
40
40
// IssueNumericPattern matches string that references to a numeric issue, e.g. #1287
41
- IssueNumericPattern = regexp .MustCompile (`( |^|\()#[0-9]+\b` )
41
+ IssueNumericPattern = regexp .MustCompile (`( |^|\(|\[ )#[0-9]+\b` )
42
42
// IssueAlphanumericPattern matches string that references to an alphanumeric issue, e.g. ABC-1234
43
- IssueAlphanumericPattern = regexp .MustCompile (`( |^|\()[A-Z]{1,10}-[1-9][0-9]*\b` )
43
+ IssueAlphanumericPattern = regexp .MustCompile (`( |^|\(|\[ )[A-Z]{1,10}-[1-9][0-9]*\b` )
44
44
// CrossReferenceIssueNumericPattern matches string that references a numeric issue in a different repository
45
45
// e.g. gogits/gogs#12345
46
46
CrossReferenceIssueNumericPattern = regexp .MustCompile (`( |^)[0-9a-zA-Z-_\.]+/[0-9a-zA-Z-_\.]+#[0-9]+\b` )
Original file line number Diff line number Diff line change @@ -345,6 +345,7 @@ func TestRegExp_IssueNumericPattern(t *testing.T) {
345
345
"#1234" ,
346
346
"#0" ,
347
347
"#1234567890987654321" ,
348
+ "[#1234]" ,
348
349
}
349
350
falseTestCases := []string {
350
351
"# 1234" ,
@@ -355,6 +356,8 @@ func TestRegExp_IssueNumericPattern(t *testing.T) {
355
356
"#1A2B" ,
356
357
"" ,
357
358
"ABC" ,
359
+ "[]" ,
360
+ "[x]" ,
358
361
}
359
362
360
363
for _ , testCase := range trueTestCases {
@@ -371,6 +374,7 @@ func TestRegExp_IssueAlphanumericPattern(t *testing.T) {
371
374
"A-1" ,
372
375
"RC-80" ,
373
376
"ABCDEFGHIJ-1234567890987654321234567890" ,
377
+ "[JIRA-134]" ,
374
378
}
375
379
falseTestCases := []string {
376
380
"RC-08" ,
@@ -383,6 +387,7 @@ func TestRegExp_IssueAlphanumericPattern(t *testing.T) {
383
387
"ABC" ,
384
388
"GG-" ,
385
389
"rm-1" ,
390
+ "[]" ,
386
391
}
387
392
388
393
for _ , testCase := range trueTestCases {
You can’t perform that action at this time.
0 commit comments