The following gist gives a thorough description of the central components in matching a given URL utilizing regular expressions in Javascript.
Regex uses a sequence of characters to define a specific search pattern. In the URL matching regex, regex matches any valid URL.
/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/