Skip to content

Instantly share code, notes, and snippets.

View CaseyDeriso's full-sized avatar
🎯
Focusing

Casey Deriso CaseyDeriso

🎯
Focusing
View GitHub Profile
@CaseyDeriso
CaseyDeriso / REGEXurlValidation.md
Last active February 21, 2023 04:13
REGEX tutorial | URL validator

Matching a URL with a Regular Expression

/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/

A regular expression (regex) is a definition for a search pattern. Regex uses a series of commands to compare a string to a set of rules.

In this case, we are trying to determine if the input is a URL.

Summary

In this episode of Who Wants to be a Regular Expression, we will break down each component of this regular expression to gain an understanding of how regular expressions work.