package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?P<project_id>\w+)(-)(?P<jira_id>\d+)`)
var str = `KEY-6
At least for jira this is the plugin request ticket for the encryption plugin KEY-662
KEY-662
wanted to follow up on KEY-668 were you able to add people to the project you needed?
https://jira.service.desk/servicedesk/customer/portal/1/KEY-668
[mm](https://jira.service.desk/servicedesk/customer/portal/1/KEY-668)
KEY-6`
var substitution = "[${project_id}-${jira_id}](https://jira.service.desk/servicedesk/customer/portal/1/${project_id}-${jira_id})"
fmt.Println(re.ReplaceAllString(str, substitution))
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/