Is there a pre-built way to find a url in a string in
ruby
URI::Extract
http://
http://test.com
http://www.test.com
www.test.com
test.com
.net
.org
.edu
I don't think there is anything pre-built for finding "strings with dots in them". Here's a start for a regex:
str =<<END_OF_STRING
http://test.com
hello.
hello http://www.test.com world
.world
hi www.test.com world
test.com
END_OF_STRING
results = str.scan(/
\S+
[.]
\S+
/xms)
--output:--
["http://test.com", "http://www.test.com", "www.test.com", "test.com"]