package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+\.[0-9]{1,3}+.*REST REQUEST(?:\n[^\S\n]*\S+.*)+`)
var str = `12:56:13.861 [http-nio-7777-exec-1] INFO dg.mpro.filter.CustomRequestLoggingFilter - REST REQUEST
NUMBERS OF REQUESTS:= [1]
METHOD:= [GET]
PARAMETERS & VALUES :=
REQUEST:= [/rest/indexv2/getMetadata]
12:56:13.861 [http-nio-7777-exec-1] INFO dg.mpro.filter.CustomRequestLoggingFilter - Response time: 1 seconds
13:14:46.049 [http-nio-7777-exec-2] INFO dg.mpro.filter.CustomRequestLoggingFilter - REST REQUEST
NUMBERS OF REQUESTS:= [2]
METHOD:= [GET]
PARAMETERS & VALUES := [pagesize:= 20][name:= Mosolv][page:= 1][tolerance:= 4]
REQUEST:= [/rest/indexv2/getProds/{{licensekey}}/{{username}}/%7B%22tolerance%22:%224%22,%22pagesize%22:%2220%22,%22name%22:%22Mosolv%22,%22page%22:%221%22%7D]
13:14:46.050 [http-nio-7777-exec-2] INFO dg.mpro.filter.CustomRequestLoggingFilter - Response time: 2 seconds
12:57:14.812 [http-nio-7777-exec-1] INFO dg.mpro.filter.CustomRequestLoggingFilter - REST REQUEST
NUMBERS OF REQUESTS:= [3]
METHOD:= [GET]
PARAMETERS & VALUES :=
REQUEST:= [/rest/indexv2/getMetadata]
12:57:14.813 [http-nio-7777-exec-1] INFO dg.mpro.filter.CustomRequestLoggingFilter - Response time: 1 seconds`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
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/