The Developer's Guide to Regular Expressions

πŸ“… 2026-05-05🏷️ Developer Tools⏱️ 8 min read

What is Regex?

A regular expression (regex) is a pattern that describes a set of strings. Regex engines are built into every major language (JavaScript, Python, C#, Java, PHP, Go).

Basic Syntax

  • . β€” Any character except newline
  • \d β€” Any digit (0–9)
  • \w β€” Word character (letters, digits, underscore)
  • \s β€” Whitespace
  • ^ β€” Start of string
  • $ β€” End of string

Quantifiers

  • * β€” Zero or more    + β€” One or more
  • ? β€” Zero or one    {3} β€” Exactly 3    {2,5} β€” Between 2 and 5

Real-World Examples

// Validate email
/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/

// Match ISO date
/\d{4}-\d{2}-\d{2}/

Try them all in our live Regex Tester.

Found this useful? Try our Regex Tester β€” browser-based and free forever.