Sha256: d4cce629c142d99e1b90c73fb59e06e93af92c339c8fd10e066fd637bbe9eb46

Contents?: true

Size: 447 Bytes

Versions: 1

Compression:

Stored size: 447 Bytes

Contents

module Http
  # (?<![.,?\!]) 1.8.7では後読みが出来ない、どーするか。
  def parse text
    url_rex = %r! 
      \b
      (
        http:// [-a-z0-9]+(\.[-a-z0-9]+)*\.(com|edu|info|net) \b 
        (
          / [-a-z0-9_:\@&?=+,.\!/~*'%\$]*[^.,?\!]
        )?
      )
    !x
    parse_text = text.gsub(url_rex){|s| "<a href=\"#$1\">#$1</a>"}
    return text if parse_text == nil
    parse_text
  end 

  module_function :parse
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wparser-0.0.2 lib/wparser/inline/http.rb