The standard URI library provides URI.regexp
which is the regular expression for url string.
require 'uri'
string.scan(URI.regexp)
More Related Contents:
- Write regular expressions [closed]
- Get all three digit numbers from array and store in new array [closed]
- /^a-eg-h/.match(‘f’) gives null in Ruby
- Regex to match Date
- Difference between \A \z and ^ $ in Ruby regular expressions
- How to match all occurrences of a regex
- Rails: What’s a good way to validate links (URLs)?
- Ruby regular expression using variable name
- How do I get the match data for all occurrences of a Ruby regular expression in a string?
- How do I remove emoji from string
- Weird backslash substitution in Ruby
- Valid email address regular expression? [duplicate]
- Extract a substring from a string in Ruby using a regular expression
- How to match all occurrences of a regular expression in Ruby
- Regex to split BBCode into pieces
- What do `?i` and `?-i` in regex mean?
- Confusion with Atomic Grouping – how it differs from the Grouping in regular expression of Ruby?
- Ruby Email validation with regex
- What is a regex to match a string NOT at the end of a line?
- Match a string against multiple patterns
- Matching balanced parenthesis in Ruby using recursive regular expressions like perl
- Interpolating a string into a regex
- Ruby: filter array by regex?
- How to use double brackets in a regular expression?
- How to match something with regex that is not between two special characters?
- Ruby class instance variable vs. class variable
- Ruby’s double colon (::) operator usage differences
- Ruby multiline block without do end
- Why does white-space affect ruby function calls?
- Logging in Sinatra?