Module: REGEXHELPER

Defined in:
lib/regexhelper.rb

Class Method Summary collapse

Class Method Details

.email_regexObject



2
3
4
5
6
# File 'lib/regexhelper.rb', line 2

def self.email_regex
  #email addresses with <= 3 letter .tld
  email_regex ||= Regexp.new('^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$')
  return email_regex
end

.image_regexObject



8
9
10
11
12
# File 'lib/regexhelper.rb', line 8

def self.image_regex
  #only images with characters and/or numbers in the filename, and an extension of .png, .jpg, .gif - ignores case.
  image_regex ||= Regexp.new('^.*([^\.][\.](([gG][iI][fF])|([Jj][pP][Gg])|([Jj][pP][Ee][Gg])|([Bb][mM][pP])|([Pp][nN][Gg])))')
  return image_regex
end