R

Regular Expressions

Master regex patterns — match, search, and extract text with an interactive pattern tester.

Programming v1.0.0 26 uses
Step 1 of 4

Step 1: What are Regular Expressions?

A regular expression (regex) is a sequence of characters that defines a search pattern. They are used to match, search, and extract text in virtually every programming language.

Here are the fundamental building blocks:

  • abcLiteral characters match themselves exactly
  • .Wildcard matches any single character (except newline)
  • \d — Matches any digit (0-9)
  • \w — Matches any word character (letter, digit, or underscore)
  • \s — Matches any whitespace (space, tab, newline)

Try typing patterns in the tester below. Start with something simple like cat or \d:

About This Lab

Regular expressions (regex) are powerful pattern-matching tools used in every programming language. In this lab, you'll learn regex syntax step by step — from simple character matches to groups and quantifiers — using a live pattern tester that highlights matches in real time.

How It Works

  1. 1 Read each step's regex concept explanation
  2. 2 Type or modify regex patterns in the tester
  3. 3 See matches highlighted instantly in the test text
  4. 4 Experiment with different patterns
  5. 5 Complete the quiz to test your understanding

Translate

ESC