A regular expression, or regex, is a sequence of characters that defines a search pattern that can be used to validate user input. This tutorial breaks down a regex used for matching a URL.
The following regex can be used to validate a URL and has been broken down in this tutorial by its components (anchor, quantifies, grouping constructs, bracket expressions, character classes, and character escapes). Each section describes the symbol, a description, and where the code is found within the regex.
Regex Matching a URL: