This gist tutorial is to explain how to match a URL using regular expression
/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
. This is going to be useful when validating URL's in applications such as nodejs.
A regular expression is a sequence of characters that defines a search pattern. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation. This tutorial will explain different components of a regex and how they are used to match a URL.