Skip to content

Instantly share code, notes, and snippets.

View NuclearReid's full-sized avatar

Reid Back NuclearReid

  • 01:47 (UTC +11:00)
View GitHub Profile
@NuclearReid
NuclearReid / NuclearReidRegexTutorial.md
Last active March 27, 2024 01:58
NuclearReid's Regex Tutorial

Reid's Regex Tutorial

Does this string mean anything to you? /^(?=.*[a-z])(?=.*[A-Z])(?=.*\W).{8,16}$/ Before I started learning about Regular Expressions, it just looked like a bunch of gibberish to me too!

This is a short tutorial that will hopefully demystify what each part of that expression means. Hopefully by the time you're done reading this tutorial, you'll be able to look at any regex and understand what pattern it's looking for.

note: to practice, click ctr find (windows), or command find (mac) and click on the .* symbol to use, practice, and see what patterns you're targetting with regex.

Summary

Here are a couple quick summaries about each section I'll be going more into:

  • Anchors: Learn how to use anchors like ^ and $ to match the start and end of a line.