/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
A regular expression (regex) is a definition for a search pattern. Regex uses a series of commands to compare a string to a set of rules.
In this case, we are trying to determine if the input is a URL.
In this episode of Who Wants to be a Regular Expression, we will break down each component of this regular expression to gain an understanding of how regular expressions work.