Initial QSfera import

This commit is contained in:
Курнат Андрей
2026-06-07 10:20:04 +03:00
commit 2315f25754
16485 changed files with 4826827 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
package matching
import (
"github.com/trustelem/zxcvbn/match"
"regexp"
)
type regexpMatch struct {
regexes []struct {
Name string
Regexp *regexp.Regexp
}
}
func (r regexpMatch) Matches(password string) []*match.Match {
var matches []*match.Match
for _, rx := range r.regexes {
for _, indexes := range rx.Regexp.FindAllStringIndex(password, -1) {
token := password[indexes[0]:indexes[1]]
matches = append(matches, &match.Match{
Pattern: "regex",
Token: token,
I: indexes[0],
J: indexes[1] - 1,
RegexName: rx.Name,
})
}
}
match.Sort(matches)
return matches
}