Skip to main content
eLearner.app

End of the Regex Course

Summary and final challenge

You have completed the 8 modules of the Regex Course — from literal a to lookarounds, named groups, and ReDoS-safe patterns. Below is the map of key concepts and a three-step final challenge that puts them to work together on real-world problems.

01 · Basics

  • literals
  • \d \w \s
  • wildcard .
  • escape

02 · Quantifiers

  • * + ?
  • {n,m}
  • greedy / lazy
  • backtracking

03 · Anchors

  • ^ $
  • \b
  • m flag
  • trim lines

04 · Groups

  • capture
  • alternatives |
  • non-capturing
  • named + \1

05 · Character classes

  • [abc]
  • [a-z]
  • [^...]
  • \p{L} with u

06 · Lookaround

  • (?=)
  • (?!)
  • (?<=)
  • (?<!)

07 · Flags & Replace

  • gimsuvyd
  • replace + $1
  • callback
  • split regex

08 · Practice

  • email
  • Apache log
  • URL/IP
  • ReDoS-safe

The final challenge, in three steps

Three real-world problems combining all course concepts: validating an Italian IBAN, parsing an Apache log with named groups, and identifying emails to redact in a text. Each exercise requires character classes, quantifiers, anchors, and groups together.

1 · Validate an Italian IBAN

An Italian IBAN is 27 characters long: `IT` + 2 control digits + 1 CIN letter + 5 ABI digits + 5 CAB digits + 12 alphanumeric characters for the account. Build the regex that matches it exactly.

Exercise#regex.boss.e1
Attempts: 0Loading…

Match an Italian IBAN: IT, 2 digits, 1 uppercase letter, 5 digits, 5 digits, 12 uppercase alphanumeric characters. Exactly 27 characters.

Loading editor…
Show hint

Concatenate: IT, \d{2}, [A-Z], \d{5}, \d{5}, [A-Z0-9]{12}, enclosed in \b.

Solution available after 3 attempts

2 · Apache log parser with named groups

From a combined Apache log line, extract `ip`, `metodo`, `path` and `status` as named groups.

Exercise#regex.boss.e2
Attempts: 0Loading…

Extract ip, metodo, path, and status from each line of Apache log. All as named groups.

Loading editor…
Show hint

Start of line ^, IP, two space-separated tokens, date in [...], request in "...", status. Use (?<ip>...), (?<metodo>...), (?<path>...), (?<status>...).

Solution available after 3 attempts

3 · Emails to redact (replace callback)

Find every email in the text with named groups `locale` and `dominio`. In a replace callback, you could redact them to `***@dominio`, preserving the domain.

Exercise#regex.boss.e3
Attempts: 0Loading…

Find every email with two named groups: locale (part before @) and dominio. Use permissive classes.

Loading editor…
Show hint

(?<locale>[\w.+-]+)@(?<dominio>[\w.-]+). In a replace callback (_, locale, dominio) it would return `***@${dominio}`.

Solution available after 3 attempts

Printable Cheatsheet

A single page with all essential JavaScript regex syntax, ready to keep at hand while programming.

Open the cheatsheet

What now?

Practice is everything: open the Playground, paste a log or any text file you come across, and try to extract the data you need. Regex are learned by solving concrete problems.