Module: Coo::Helper::RegexpCollection

Defined in:
lib/coo/helper/regexp_collection.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.n_a_1单个 number alphabet

Returns:

  • (单个 number alphabet)


15
16
17
# File 'lib/coo/helper/regexp_collection.rb', line 15

def self.n_a_1
  return /^[0-9A-Za-z]$/
end

.n_a_u_h_0_n0个或多个 number alphabet undlerline hyphen

Returns:

  • (0个或多个 number alphabet undlerline hyphen)


6
7
8
# File 'lib/coo/helper/regexp_collection.rb', line 6

def self.n_a_u_h_0_n
  return /^[A-Za-z0-9_-]*$/
end

.n_a_u_h_1_nObject



10
11
12
# File 'lib/coo/helper/regexp_collection.rb', line 10

def self.n_a_u_h_1_n
  return /^[A-Za-z0-9_-]+$/
end

Instance Method Details

#valid_str?(str, valid_regexp) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/coo/helper/regexp_collection.rb', line 19

def valid_str?(str, valid_regexp)
  return true if (valid_regexp.match(str))
  false
end