Regex Tester
Test regular expressions with live match highlighting, group capture, and replacement.
No matches found.
A regex tester is a tool that lets you write a regular expression pattern and test it against sample text in real time, showing which parts of the text match and highlighting capture groups. Developers use regex testers to build and debug patterns for input validation, text extraction, search-and-replace operations, and log parsing. AlteredIdea's regex tester runs entirely in your browser: your patterns and test strings are never sent to any server.
Free regex tester: test and debug regular expressions with live highlighting
Regular expressions are one of the most powerful: and most misunderstood: tools in a developer's arsenal. A small mistake in a pattern can match too much, too little, or cause catastrophic backtracking on certain inputs. Testing regexes against real data before deploying them to production code saves hours of debugging.
This tool gives you an interactive workspace: type your pattern and every match is highlighted in real time on your test string. Captured groups are displayed beneath each match, replace mode shows substituted output live, and all standard JavaScript flags are supported. Everything runs in the browser: paste sensitive log data or PII without worrying about it being transmitted anywhere.
Step-by-step guide
- 1Enter your regular expression
Type your regex pattern into the expression field. The tool validates it in real time and shows a syntax error if the pattern is invalid. - 2Set your flags
Toggle flags such as global (g), case-insensitive (i), multiline (m), or dotAll (s) using the flag buttons. - 3Paste your test string
Enter or paste the text you want to test against. All matches are highlighted immediately as you type. - 4Inspect match details
Click on any highlighted match to see the full match, captured groups, match index, and length in the details panel. - 5Use replace mode
Switch to Replace mode, enter a replacement string (supports $1 back-references), and preview the substituted output alongside the match count.
Related Tools
JSON Formatter
Validate, format, minify, and explore JSON. Syntax highlighting, error detection, and tree view.
HTML Beautifier
Format messy HTML with proper indentation. Also minifies HTML for production.
SQL Formatter
Format SQL queries with keyword casing, indentation, and clause alignment.
Base64
Encode and decode Base64 strings and files. Supports text, binary, and data URLs.
Frequently Asked Questions
- What regex flavour does this tool use?
- The tool uses JavaScript's built-in RegExp engine, which follows the ECMAScript specification. This is the same engine used in browsers and Node.js. It supports lookaheads, lookbehinds, named capture groups, Unicode property escapes, and all standard flag combinations.
- Which regex flags are supported?
- All JavaScript flags are supported: g (global: find all matches), i (case-insensitive), m (multiline: ^ and $ match line boundaries), s (dotAll: dot matches newline), u (Unicode mode), and d (indices: report start/end positions for each match and group).
- How do I test a regex with capture groups?
- Write your pattern with parentheses to define capture groups, e.g. (\d{4})-(\d{2})-(\d{2}) to capture year, month, and day from a date. Each match in the details panel lists the full match followed by the value of each numbered group.
- What are named capture groups and how do I use them?
- Named groups use the syntax (?<name>pattern). For example (?<year>\d{4})-(?<month>\d{2}) names the captured substrings. The details panel shows both the numeric index and the name of each group, and in replace mode you can reference them with $<name>.
- How does replace mode work?
- Switch to Replace mode and enter your replacement string. Standard back-references like $1, $2 (or $<name> for named groups) are supported. The tool previews the fully substituted output string in real time so you can verify the result before copying it.
- Why does my regex match nothing when it looks correct?
- The most common causes are: forgetting the g flag when you expect multiple matches, a missing escape for special characters (e.g. a literal dot must be \. not .), or a mismatch between Unicode mode and non-ASCII characters. Check the error bar: if no error is shown, try enabling the i or m flags.
- Can I test multiline strings?
- Yes. Paste text with newlines directly into the test area. Enable the m flag to make ^ and $ match the start and end of each line, and enable the s flag to make . match newline characters.
- Does the tool support lookahead and lookbehind assertions?
- Yes. JavaScript supports positive and negative lookaheads (?=...) and (?!...) as well as positive and negative lookbehinds (?<=...) and (?<!...). All are fully supported and highlighted in the match results.
- Is my test data private?
- Yes. The regex engine runs entirely in your browser. Your patterns and test strings are never sent to a server, so sensitive log data, personal information, or proprietary formats remain completely private.
- Can I use this for languages other than JavaScript?
- The tool is based on the JavaScript regex engine. Most patterns are compatible with other PCRE-based languages (Python, PHP, Java) for common features, but advanced features like atomic groups or possessive quantifiers are not supported since JavaScript does not implement them.
AlteredIdea vs alternatives
vs server-side tools: Everything runs in your browser: your data never leaves your device.
vs VS Code extensions: No install needed. Works instantly in any browser.
vs paid tools: Completely free, no account required.