Regex Tester
Flags
Type a regular expression, paste the text to test it against, and the tester runs the pattern and lists every match it finds. Each result shows where the match starts and the contents of every capture group, so you can see exactly what the pattern picked up. Toggle the case-insensitive, multiline and dotall flags to change how the pattern behaves.
How to test a regex
-
1
Enter your pattern
Type the expression without delimiters; the tester wraps it in `/ /` for you. An invalid pattern shows a clear error message instead of failing silently.
-
2
Choose the flags
Turn on `i` (case-insensitive), `m` (multiline) or `s` (dotall) to match the way you need.
-
3
Paste the test text
Add the text you want to search. The tester scans all of it and finds every match, not just the first.
-
4
Inspect the matches
Each match lists its position (offset) in the text, the full match, and every numbered capture group.
What the tester shows you
Running a pattern in your head, or with a quick grep, tells you whether something matches. The tester also shows:
- Every match, with its position. It always searches the whole text and reports each match with the character offset where it begins.
- Which group captured what. Each match is broken into its full match and the numbered capture groups, so you can confirm a
(...)grabbed the piece you expected. - What the flags change. Toggle
i,morsand run the test again to see how case-insensitive, multiline or dotall matching changes the result.
The flags, in plain terms
| Flag | Name | What it changes |
|---|---|---|
i |
Case-insensitive | A also matches a, and the reverse |
m |
Multiline | ^ and $ match at the start and end of each line, not just the whole text |
s |
Dotall | . also matches newline characters |
Matching is always global: the tester returns every match in the text, so there is no separate “global” flag to set. Patterns run on the PCRE engine with Unicode support, so classes like \w and \d behave consistently on international text.
Common regex problems this helps you spot
| Symptom | Usual cause |
|---|---|
| One giant match covering everything | .* is greedy; use .*? or a negated class like [^"]* |
^ or $ only matching once |
Missing the m flag on multi-line text |
. stops at line breaks |
Missing the s flag |
| Capture groups in an unexpected order | Nested ( shift the group numbers; count them left to right |
| A pattern that runs slowly | Nested * or + over overlapping choices causes heavy backtracking |
Tips for faster, safer patterns
- Anchor with
^when the match starts at the beginning, so the engine does not scan the whole string. - Prefer a character class (
[abc]) over alternation (a|b|c); classes are faster in every major engine. - Replace a greedy
.*with a negated class such as[^"]*when you know the terminator, so there is no backtracking.
Frequently Asked Questions
It runs your pattern with PCRE, the engine built into PHP, with Unicode mode on. Syntax specific to PCRE, such as \d, \b and lookarounds, works as expected. If you will deploy the pattern in JavaScript, Python or another language, check the small syntax differences before you ship.
Every match. The tester always searches the whole text, so there is no separate “global” flag to set. Each match is listed with its position in the text.
Yes. Each match is broken down into the full match and every numbered capture group, so you can confirm which part of the text each (...) captured.
i makes matching case-insensitive, m makes ^ and $ match at each line boundary, and s lets . match newline characters. Turn them on or off and run the test again to compare the results.
The tester shows a clear error message describing the problem, such as an unbalanced bracket or an unterminated group, instead of silently returning no matches.
Related Tools
ASCII Table Reference
Full ASCII table from 0 to 127 with decimal, hex, octal, binary, standard names and HTML numeric-reference notation, including NUL, LF and DEL.
Color Palette Generator
Generate monochromatic, analogous, complementary, triadic or tetradic color palettes from a base HEX color and export copy-ready CSS variables.
FPS Counter
Measure browser FPS with requestAnimationFrame, smoothing, min/max frame rate, warnings and an optional graph. Runs locally with no upload or API.
HTML Character Reference
Searchable list of HTML entities, their named and numeric codes, and a one-click copy for special characters and symbols.
HEX Color Picker
Pick or enter a HEX colour and get RGB, HSL, approximate CMYK, relative luminance and contrast ratios against white and black.
Keyboard Shortcut Reference
Search documented default keyboard shortcuts for VS Code, Chrome and Bash with GNU Readline on macOS, Windows and Linux.
Tool available in other languages
- أداة اختبار Regex [AR]
- Testeur de Regex [FR]
- 정규식 테스터 [KO]
- Penguji Regex [ID]
- Regex-Tester [DE]
- Tester Regex [PL]
- Regex-tester [NL]
- Regex-testare [SV]
- ตัวทดสอบ Regex [TH]
- 正規表現テスター [JA]
- Trình kiểm tra Regex [VI]
- Probador de Regex [ES]
- Testador de Regex [PT]
- Regex Test Aracı [TR]
- 正则测试器 [ZH]
- Tester di Regex [IT]
- Тестер Regex [RU]