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?
You can use regex and .scan()
string.scan(/(https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?)/)
You can get started with that regex and adjust it according to your needs.