Regex with lookaheads

I’d like to implement the following regex in Go, can it be done because Go doesn’t support lookaheads, is there a way to convert the regex into something Go can handle?

^((?=.*[a-z])(?=.*[A-Z])(?=.*\d)|(?=.*[a-z])(?=.*[A-Z])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*\d)(?=.*[^A-Za-z0-9])|(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]))([A-Za-z\d@#$%^&£*\ -_+=[\]{}|\\:',?/~"();!]|\.(?!@)){8,16}$`)

For background, the expression is supposed to be the one that Microsoft use as the default when you turn basic password complexity checking on. There are some alternatives offered but they all use lookaheads so all suffer from the same issue.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.