Skip to content

Instantly share code, notes, and snippets.

View wonjong2's full-sized avatar
😎

Wonjong Park wonjong2

😎
View GitHub Profile
@wonjong2
wonjong2 / regex_tutorial_wonjong.md
Last active June 24, 2022 22:21
Tutorial for Regex Expression

Regular Expression Tutorial (Matching a URL)

A Regular Expression (shortened as 'regex' or 'regexp') is a sequence of characters that defines a specific search patten in text. Most general-purpose programming launguages support regex capabilities either natively or via libraries, including for example JavaScript, Python, C, C++ and Java.

Summary

In this Gist, Let's break down the regex for matching a URL and take a look at each component.

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