Sha256: c71d6f4e3e4e8065bb31644fce1e85fdf3dfa30e8305230b49febecbbe10ee55

Contents?: true

Size: 784 Bytes

Versions: 5

Compression:

Stored size: 784 Bytes

Contents

module Langusta
  module RegexHelper
    if RUBY_VERSION < "1.9"
      include Oniguruma
      
      ROMAN_REGEX = ORegexp.new("^[a-z]$", :options => OPTION_IGNORECASE)
      INCL_ROMAN_REGEX = ORegexp.new(".*[a-z].*", :options => OPTION_IGNORECASE)
      URL_REGEX = ORegexp.new("https?://[-_.?&~;+=/#0-9a-z]+", :options => OPTION_IGNORECASE)
      MAIL_REGEX = ORegexp.new("[-_.0-9a-z]+@[-_0-9a-z]+[-_.0-9a-z]+", :options => OPTION_IGNORECASE)
      SPACE_REGEX = ORegexp.new(" +")
    else
      # /ui stands for UTF-8 case-insensitive regexp.
      ROMAN_REGEX = /^[a-z]$/ui
      INCL_ROMAN_REGEX = /.*[a-z].*/ui
      URL_REGEX = Regexp.new("https?://[-_.?&~;+=/#a-z0-9]+")
      MAIL_REGEX = /[-_.a-z0-9]+@[-_a-z0-9]+[-_.a-z0-9]+/ui
      SPACE_REGEX = / +/
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
langusta-0.2.4 lib/langusta/regex_helper.rb
langusta-0.2.3 lib/langusta/regex_helper.rb
langusta-0.2.2 lib/langusta/regex_helper.rb
langusta-0.2.1 lib/langusta/regex_helper.rb
langusta-0.2.0 lib/langusta/regex_helper.rb