Skip to content

Instantly share code, notes, and snippets.

View brandonfordd's full-sized avatar

Brandon Ford brandonfordd

View GitHub Profile
@brandonfordd
brandonfordd / regex-tutorial.md
Last active June 19, 2021 13:01
Computer Science for JavaScript: Regex Tutorial

Regex Tutorial on Matching a URL

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.

Summary

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 \.-]*)*\/?$/.

Table of Contents