Replacing the urls in a block of plain text is done by looking for url regular expressions. I am using string.gsub(regex, "\1") to achieve the same.
I would like to know how to proceed if the shortened url (using api's of any url shortening service) is to be used as the replacement and not the original url.
I am using Ruby.