What is the Regex Tester?
A regular expression (regex) is a compact pattern language for matching text. Developers use regexes to validate input, extract values from logs, search and replace in editors, and route URLs. They are powerful but easy to get subtly wrong, which is why testing a pattern against real samples before putting it in code is worth the minute it takes.
This tester uses the JavaScript regular expression engine, so behaviour matches what you will get in the browser and in Node.js. Flags change how a pattern works: g finds all matches, i ignores case, m makes ^ and $ match at line boundaries, s lets . match newlines, and u enables full Unicode matching.
When to use the Regex Tester
Build and verify patterns here before they reach your codebase: validating form fields, extracting IDs or dates from logs, rewriting URLs, cleaning data with search and replace, or splitting text by a complex delimiter. Testing against several realistic samples, including inputs that should not match, catches the bugs that otherwise show up in production. It is also a good place to learn, because the instant highlighting makes the effect of each quantifier, anchor and group visible while you experiment.
How to use the Regex Tester
- Enter your pattern between the slashes, without the surrounding
/characters. - Toggle the flags you need, such as
gandi. - Paste sample text into the test area.
- Matches are highlighted live; the list below shows each match, its index and capture groups.
- Refine the pattern until only the intended text matches, then copy it into your code.
Examples
Pattern: (\d{4})-(\d{2})-(\d{2})
Flags: g
Text: Released 2026-10-02, patched 2026-10-15.
Match 1: 2026-10-02 groups: 2026, 10, 02
Match 2: 2026-10-15 groups: 2026, 10, 15
Named groups: (?<year>\d{4})-(?<month>\d{2})
Email (simple): [^\s@]+@[^\s@]+\.[^\s@]+Common errors and tips
- Greedy vs lazy:
.*grabs as much as possible; use.*?to stop at the first possible end. - Escape special characters like
. ? + * ( ) [ ] { } | \ ^ $when you want them literally. - Catastrophic backtracking from nested quantifiers such as
(a+)+can freeze a page; keep patterns simple. - A pattern with the
gflag keeps state inlastIndexwhen used with.test()repeatedly, a frequent source of confusing bugs. - Do not validate email addresses or HTML with a regex alone; use a proper parser or confirmation email.
Privacy: runs entirely in your browser
Patterns and sample text, which may include log lines or customer data, are evaluated locally in your browser and never uploaded. This tool runs entirely in your browser: nothing you enter is uploaded, stored or logged on our servers, and it keeps working even if you go offline after the page has loaded.
Frequently asked questions
Which regex flavour does this tester use?
The JavaScript (ECMAScript) engine built into your browser. Lookbehind, named groups and Unicode property escapes work in modern browsers.
What do the g, i, m, s and u flags mean?
g finds all matches, i ignores case, m makes ^ and $ match per line, s lets the dot match newlines, and u enables Unicode mode.
Why does my regex match too much?
* and + are greedy. Add ? to make them lazy, or use a more specific character class instead of the dot.How do I match a literal dot or bracket?
\. or \[.What are capture groups?
(?<year>\d{4}) make the result easier to read.Ratings & reviews
–
0 reviews
- 5 star
- 0 reviews (0%)
- 4 star
- 0 reviews (0%)
- 3 star
- 0 reviews (0%)
- 2 star
- 0 reviews (0%)
- 1 star
- 0 reviews (0%)
No reviews yet — be the first to share your experience.
Write a review
Reviews are moderated before they appear.
Related tools
Beautify, minify and validate JSON instantly, with exact line and column for every syntax error.
Use toolEncode text to Base64 or decode Base64 back to readable UTF-8, including URL-safe Base64.
Use toolGenerate random v4 and time-ordered v7 UUIDs in bulk, with one-click copy and format options.
Use toolDecode JSON Web Tokens to inspect the header, payload and expiry, all without sending the token anywhere.
Use toolConvert Unix timestamps to readable dates and back, in UTC or your local timezone, in seconds or milliseconds.
Use toolJSON to CSV Converter
Developer
Turn an array of JSON objects into a clean CSV file for Excel or Google Sheets in one click.
Use tool
