package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)transactionId=(?<transactionId>.*?)}.*ResourceId:\s(?<featureName>.*?),.*CPNYID_(?<companyId>\d+)_AID_(?<aPaymentId>\d+)`)
var str = `2020-Apr-10 09:32:50.086 PDT [pool-4-thread-1] INFO com.adp.taxmod.lock.service.NTLockServiceImpl {createdDate=Fri Apr 10 09:32:49 PDT 2020, id=4-699211, transactionId=3746ddf0-e602-409b-831c-d0cd995c5595} - NTLockServiceImpl : acquireLock() - ResourceId: CREDIT_RECONCILE, ResourceType: {} CPNYID_25817065_AID_996`
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/