Here you go, working code :) strips out the http/s prefix in the displayed link also
note you should regex on uri+" " so it catches the links properly... and then you need to add a space at the beginning to catch links at the end that don't have a trailing space...
thisString = yourString+" " # add space to catch link at end
URI.extract(thisString, ['http', 'https']).each do |uri|
linkURL = uri
if(uri[0..6] == "http://")
linkURL = uri[7..-1]
elsif(uri[0..7] == "https://")
linkURL = uri[8..-1]
end
thisString = thisString.gsub( uri+" ", "<a href=\"#{uri.to_s}\">#{linkURL.to_s}</a> " )
end