Overview URI module can be used to extract URL from a given string https://ruby-doc.org/stdlib-2.5.1/libdoc/uri/rdoc/URI.html We can use the Extract method of the URI module https://ruby-doc.org/stdlib-2.5.1/libdoc/uri/rdoc/URI.html#method-c-extract Below is the signature of the method…