is there pre-built way find url-like string within string in ruby
? have heard of uri::extract
playing around it, seems find urls prefixed http://
i need able find url-like string in string, example:
http://test.com http://www.test.com www.test.com test.com
should found , returned me.
i know tackle in regex rather use prebuilt if there exists. should find .net
, .org
, .edu
etc.
i don't think there pre-built finding "strings dots in them". here's start 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"]