package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?ms)EventCode\=5145.*Message\=A network share object was checked to see whether client can be granted desired access.`)
var str = `LogName=Security
SourceName=Microsoft-Windows-Security-Auditing
EventCode=5145
EventType=4
Type=Success Audit
ComputerName=xxxx
Category=11111
CategoryString=none
RecordNumber=xxxx
Message=A network share object was checked to see whether client can be granted desired access.
Subject:
Security ID:
Account Name:
Account Domain:
Logon ID:
Network Information:
Object Type: File
Source Address:
Source Port:
Share Information:
Share Name:
Share Path: \
Relative Target Name: x.dxmdg.com\Policies\{123456789456456456454654464546464558655}\Machine\Preferences\Registry\Registry.xml
Access Request Information:
Access Mask:
Accesses:
Access Check Results:`
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/