How do I extract all URLs from a plain text file in Ruby?
I tried some libraries but they fail in some cases. What\'s the best way?
What cases are failing?
According to the library regexpert, you can use
regexp = /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix
and then perform a scan on the text.
EDIT: Seems like the regexp supports the empty string. Just remove the initial (^$) and you're done