
How to use
- Type your pattern in REGEX PATTERN, for example (\w+)-(\d+), and set the FLAGS such as g, i or m.
- Paste the text to search into SAMPLE TEXT. Every match is highlighted in HIGHLIGHT RESULT as you type, and the match count updates.
- Open CAPTURE GROUPS to see the full match and each group, which is what you would read in code.
- Pick a LANGUAGE and click COPY SNIPPET to get ready-to-run code in JavaScript, TypeScript, Python, PHP, C# or Go.
Test a regular expression in real time
A regex tester shows exactly what a pattern matches before you put it in code, which saves the guess-run-fix loop. Matches update as you type, a syntax error is reported right away, and the capture groups show what each pair of parentheses picked up.
The tester uses the JavaScript regular expression engine built into your browser, the same one Node.js and front-end code use. Most everyday patterns work the same in Python, PHP, C# and Go, but some features differ between engines, so run the generated snippet in your language once.
Flags
Flags change how the whole pattern behaves:
| Flag | Name | Effect |
|---|---|---|
| g | global | Find all matches, not only the first |
| i | ignore case | Treat upper and lower case as the same |
| m | multiline | Make ^ and $ match at the start and end of each line |
| s | dotAll | Let . also match line breaks |
| u | unicode | Treat the pattern and text as Unicode code points |
| y | sticky | Match only at the current position |
| d | indices | Record where each capture group starts and ends |
Patterns people look up most
Some starting points you can paste and adapt: digits only ^\d+$; a simple email check [^\s@]+@[^\s@]+\.[^\s@]+; a US ZIP code ^\d{5}(-\d{4})?$; a date like 2026-10-24 (\d{4})-(\d{2})-(\d{2}); and repeated spaces \s{2,}. Test each against both text that should match and text that should not.
Be careful with patterns that nest repetition, such as (a+)+, on long input: they can take a very long time in many engines. Prefer specific character classes over .* when you can, and add ^ and $ when the whole string must match.
Frequently asked questions
Which regex flavor does this tester use?
JavaScript (ECMAScript), as built into your browser. Patterns that use features specific to PCRE, Python or .NET may need small changes; the code snippet helps you check in your language.
Why does my pattern only find one match?
Without the g (global) flag, a JavaScript regex stops after the first match. The tester lists all matches, but add g in your code if you want every one.
How do I match a literal dot or bracket?
Escape it with a backslash: \. matches a dot, \( a parenthesis and \[ a bracket. Without the backslash, these characters have a special meaning.
Is my text uploaded?
No. Matching runs in your browser, so you can safely test patterns on logs or data you cannot share.