Regular expressions, per definition, are a series of special characters that define a search pattern. Always defined in a string, they can be used to find and replace sequence characters and validate inputs.
In this tutorial I'll be decribing how the regex for matching a URL works. The key topics that will be reflected on are the Anchors, Quantifiers, Grouping Constructs, Bracket Expressions, Character Classes, The OR Operator, Flags, and Character Escapes.
Regex for Matching a URL : /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
.