class EacRubyUtils::Wildcards
The ‘Wildcards` class provides pattern matching with wildcards using regular expressions.
def initialize(pattern)
-
pattern
(String
) -- The pattern to match against.
def initialize(pattern) @pattern = pattern end
def regex
-
(Regexp)
-
def regex ::Regexp.new("^#{::Regexp.escape(@pattern).gsub('\*', '.*').gsub('\?', '.?')}$") end