Regex Wizard
Build regular expressions interactively without knowing regex syntax - use the pattern builder or choose from pre-built patterns.
Loading...
What is a Regular Expression (Regex)?
A regular expression (regex) is a pattern used to match text. It's like a powerful search tool that can:
- Find patterns: Email addresses, phone numbers, dates, etc.
- Validate input: Check if text matches a specific format
- Extract data: Pull specific information from larger text
- Replace text: Find and replace with pattern matching
Common Use Cases
- Email validation: Verify email addresses are properly formatted
- Phone extraction: Find all phone numbers in a document
- Data cleaning: Extract specific data from messy text
- Form validation: Ensure user input matches expected format
Quick Regex Reference
\d- Any digit (0-9)\w- Any word character (letter, digit, underscore)\s- Any whitespace (space, tab, newline)+- One or more of the previous character*- Zero or more of the previous character?- Zero or one of the previous character (optional)[abc]- Any character in the brackets (a, b, or c)[0-9]- Any digit from 0 to 9.- Any single character
The Slashes and the Letters After Them
The pattern above is shown as /pattern/g. The two slashes are not part of the pattern:
they only mark where it starts and ends, the way quotation marks do for text. The letters after the
second slash are options for the whole pattern:
g- Find every match in the text, not only the first one. Always shown here.-
i- Treat capital and small letters as the same. Added when you tick that option. -
m- Check the text line by line. Added with the option that the whole line must match.
So /cat/gi finds every "cat", "Cat" and "CAT". JavaScript writes patterns exactly this way.
Most other languages and tools, such as Python, take only the part between the slashes, which is what
the Copy button gives you; there the options are set separately.
Tip: Start with a preset pattern and modify it, or build a custom pattern step-by-step. Test your pattern against real text to see what it matches!