Module: Zxcvbn::Matchers::RegexHelpers
Instance Method Summary collapse
Instance Method Details
#re_match_all(regex, password) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/zxcvbn/matchers/regex_helpers.rb', line 4 def re_match_all(regex, password) loop do re_match = regex.match(password) break unless re_match i, j = re_match.offset(0) j -= 1 match = Match.new( :i => i, :j => j, :token => password[i..j] ) yield match, re_match password = password.sub(re_match[0], ' ' * re_match[0].length) end end |