package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)\b(?=.*\d)(?=.*[A-Z])(?=.*[a-z])[A-Za-z\d]{8}\b`)
var str = `What SHOULD match:
Passw8rd
on1oN!91
Yb9udbsk
I am getting matches in regex101 for the following strings that I do NOT WANT to match:
88888888
869guifr
Password
`
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/