mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-28 11:20:30 +00:00
change regex to global regex
This commit is contained in:
parent
e919be5210
commit
63a0659aa4
1 changed files with 4 additions and 2 deletions
|
@ -193,10 +193,12 @@ func convertPushHook(hook *internal.PushHook, change *internal.Change) *model.Bu
|
|||
return build
|
||||
}
|
||||
|
||||
// regex for git author fields ("name <name@mail.tld>")
|
||||
var reGitMail = regexp.MustCompile("<(.*)>")
|
||||
|
||||
// extracts the email from a git commit author string
|
||||
func extractEmail(gitauthor string) (author string) {
|
||||
re := regexp.MustCompile("<(.*)>")
|
||||
matches := re.FindAllStringSubmatch(gitauthor,-1)
|
||||
matches := reGitMail.FindAllStringSubmatch(gitauthor,-1)
|
||||
if len(matches) == 1 {
|
||||
author = matches[0][1]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue