scanning for links

Have you looked at the auto_link Rails helper method?

http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M000621