This problem is also suited to being solved using regular expressions. Finding a regular expression that could match any URL is, however, a difficult task. The purpose of this exercise is to help you practice your skills with the regex library, and not to find the ultimate regular expression for this particular purpose. Therefore, the regular expression used here is provided only for didactic purposes.
For this task we will consider that a URL has the following parts: protocol and domain are mandatory, and port,