Skip to main content

JavaScript Regular Expressions

8 lessonsAbout 48 minutesAdvanced

This part of the JavaScript Tutorial runs from JavaScript Regular Expressions through to JavaScript Regex in Practice. There are 8 lessons here, and working through them takes about 48 minutes at a steady pace.

It follows on from JavaScript Dates, so finish that first if you have not already — the examples below assume you are comfortable with it.

Each lesson below says what it covers before you open it. Read them in order the first time; afterwards this page works as a index you can jump back into when you need to check one thing.

  1. 1JavaScript Regular ExpressionsA regular expression describes a pattern of text rather than exact text.
  2. 2JavaScript Regex CharactersCharacter classes match a kind of character rather than a specific one.
  3. 3JavaScript Regex QuantifiersQuantifiers say how many times a pattern should repeat.
  4. 4JavaScript Regex AnchorsAnchors tie a pattern to the start or end of the text.
  5. 5JavaScript Regex GroupsGroups capture part of a match so you can use it afterwards.
  6. 6JavaScript Regex MethodsSeveral string and regex methods work together to search and replace.
  7. 7JavaScript Regex ValidationRegular expressions are commonly used to check the shape of input.
  8. 8JavaScript Regex in PracticeA few everyday patterns cover most of what regular expressions are used for.