Class: Zxcvbn::Matchers::Year Private

Inherits:
Object
  • Object
show all
Includes:
RegexHelpers
Defined in:
lib/zxcvbn/matchers/year.rb,
sig/zxcvbn/matchers/year.rbs

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Matches 4-digit year substrings (1900–2019) in the password.

Constant Summary collapse

YEAR_REGEX =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Matches years from 1900 to 2019, matching zxcvbn.js v4.

Returns:

  • (Regexp)
/19\d\d|200\d|201\d/

Instance Method Summary collapse

Methods included from RegexHelpers

#re_match_all

Instance Method Details

#matches(password) ⇒ Array<MatchBuilder>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns matches with pattern "year".

Parameters:

  • password (String)

Returns:



17
18
19
20
21
22
23
24
# File 'lib/zxcvbn/matchers/year.rb', line 17

def matches(password)
  result = []
  re_match_all(YEAR_REGEX, password) do |match|
    match.pattern = 'year'
    result << match
  end
  result
end