Regex 101 shows this regex as valid:
/during.*\(\"\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])\",.*\"\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])\"\)|during.*\(startOfMonth\(\),.*now\(\)\)/gm
but using it in Go, it does not appear to work when attempting FindAllString
(Go Playground)
package main
import (
"fmt"
"regexp"
)
var duringRegex *regexp.Regexp
func init() {
duringRegex = regexp.MustCompile(`/during.*\(\"\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])\",.*\"\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])\"\)|during.*\(startOfMonth\(\),.*now\(\)\)/gm`)
}
func main() {
jqlDuringBeginningOfMonthToEndOfMonth := "project = SWB AND status changed from \"In Regression\" to (Done) during (\"2022-09-01\", \"2022-09-30\")"
jqlDuringStartOfMonthToNow := "project = SWB AND status changed from \"In Regression\" to (Done) during (startOfMonth(), now())"
fmt.Printf("result: %s", duringRegex.FindAllString(jqlDuringBeginningOfMonthToEndOfMonth, -1))
fmt.Println()
fmt.Printf("result: %s", duringRegex.FindAllString(jqlDuringStartOfMonthToNow, -1))
}
Run shows:
result: []
result: []
Program exited.
I suspect this behaviour has to do with escaped quotes in the JQL strings. Changing the JQL strings to use single quotes did not make a difference in the results, either.