This is a tutorial with the purpose of introducing some basic concepts of regular expressions, or more commonly known as RegEx in which a pattern string of characters is used to define a specific search pattern to locate and/or validate character sequences in a string. I will break down the RegEx used to validate a URL in order to demonstrate how they can be built and used.
This tutorial will provide basic regular expression information and then use a given expression to validate a URL to elucidate RegEx pattern matching concepts and syntax.
Sample RegEx for matching and validating a URL:
/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/