Skip to content

Commit b44e000

Browse files
charles7668GiteaBot
authored andcommitted
1 parent a86d933 commit b44e000

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

modules/references/references.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ var (
3131
// mentionPattern matches all mentions in the form of "@user" or "@org/team"
3232
mentionPattern = regexp.MustCompile(`(?:\s|^|\(|\[)(@[0-9a-zA-Z-_]+|@[0-9a-zA-Z-_]+\/?[0-9a-zA-Z-_]+|@[0-9a-zA-Z-_][0-9a-zA-Z-_.]+\/?[0-9a-zA-Z-_.]+[0-9a-zA-Z-_])(?:\s|[:,;.?!]\s|[:,;.?!]?$|\)|\])`)
3333
// issueNumericPattern matches string that references to a numeric issue, e.g. #1287
34-
issueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\')([#!][0-9]+)(?:\s|$|\)|\]|[:;,.?!]\s|[:;,.?!]$)`)
34+
issueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\'|\")([#!][0-9]+)(?:\s|$|\)|\]|\'|\"|[:;,.?!]\s|[:;,.?!]$)`)
3535
// issueAlphanumericPattern matches string that references to an alphanumeric issue, e.g. ABC-1234
36-
issueAlphanumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[)([A-Z]{1,10}-[1-9][0-9]*)(?:\s|$|\)|\]|:|\.(\s|$))`)
36+
issueAlphanumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\"|\')([A-Z]{1,10}-[1-9][0-9]*)(?:\s|$|\)|\]|:|\.(\s|$)|\"|\')`)
3737
// crossReferenceIssueNumericPattern matches string that references a numeric issue in a different repository
3838
// e.g. org/repo#12345
3939
crossReferenceIssueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[)([0-9a-zA-Z-_\.]+/[0-9a-zA-Z-_\.]+[#!][0-9]+)(?:\s|$|\)|\]|[:;,.?!]\s|[:;,.?!]$)`)

modules/references/references_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ func TestRegExp_issueNumericPattern(t *testing.T) {
429429
" #12",
430430
"#12:",
431431
"ref: #12: msg",
432+
"\"#1234\"",
433+
"'#1234'",
432434
}
433435
falseTestCases := []string{
434436
"# 1234",
@@ -459,6 +461,8 @@ func TestRegExp_issueAlphanumericPattern(t *testing.T) {
459461
"(ABC-123)",
460462
"[ABC-123]",
461463
"ABC-123:",
464+
"\"ABC-123\"",
465+
"'ABC-123'",
462466
}
463467
falseTestCases := []string{
464468
"RC-08",

0 commit comments

Comments
 (0)