Created
August 2, 2014 16:00
-
-
Save murugan-r/bf59d6b373f513c6544e to your computer and use it in GitHub Desktop.
Revisions
-
murugan-r created this gist
Aug 2, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ require 'uri' hostname = "(?:(?:[\\w\\-]+\\.)+[[:alpha:]]{2,})" host = "(?:#{hostname}|#{URI::DEFAULT_PARSER.pattern[:IPV4ADDR]}|#{URI::DEFAULT_PARSER.pattern[:IPV6ADDR]})" server = "//(?:#{URI::DEFAULT_PARSER.pattern[:USERINFO]}@)?#{host}(?::\\d*)?" absolute_path = "(?:#{URI::DEFAULT_PARSER.pattern[:ABS_PATH]})?" query = URI::DEFAULT_PARSER.pattern[:QUERY] http_uri_regex = Regexp.new("\\A(?:http|https):(?:#{server}#{absolute_path})(?:\\?(?:#{query}))?\\z", Regexp::EXTENDED, 'N')