package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?mi)^[^'\n\r]*On Error Goto`)
var str = `Match:
on error goto err_handler
if aap = 0 then on error goto Myerrorhandler
on error goto errorhandler1
on error goto errorhandler2
Do not match:
' on error goto errorhandler3
' if aap =0 then on error goto errorhandler4
Any line not containing On Error Got0`
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/