How do I rewrite regex in golang to work around no support for positive lookaheads?

Viewed 25

I am trying to write a regex password validator that checks for at least one number, and at least one lower and uppercase letter, which is easiest using positive lookaheads. Unfortunately, it is not supported by golang, so how can I rewrite an equivalent version?

This is what I have currently:

regexp.MustCompile("(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])")

Of course, it generates the error message error parsing regexp: invalid or unsupported Perl syntax, but I'm not sure how I can change it.

0 Answers
Related