method

extract

v1_8_6_287 - Show latest stable - Class: URI
extract(str, schemes = nil, &block)
public

Synopsis

  URI::extract(str[, schemes][,&blk])

Args

str:String to extract URIs from.
schemes:Limit <a href="/ruby/URI">URI</a> matching to a specific schemes.

Description

Extracts URIs from a string. If block given, iterates through all matched URIs. Returns nil if block given or array with matches.

Usage

  require "uri"

  URI.extract("text here http://foo.example.org/bla and here mailto:[email protected] and here also.")
  # => ["http://foo.example.com/bla", "mailto:[email protected]"]