Regex Tester
TextEverything runs locally in your browser — nothing is uploaded
COMMON PATTERNS
Matching and replacing happen locally in your browser — neither the pattern nor the text is uploaded.
Build a regular expression in the browser: matches highlight as you type, capture groups including named ones are listed one by one, and entering a replacement previews the whole text rewritten. The tool also guards against catastrophic backtracking — a pattern such as (a+)+ can lock a browser tab for seconds on long input, so it is detected up front, refused on long text, and the reason is spelled out instead of pretending the scan finished.
Features
- Live highlighting of every match, with zero-width matches such as \b and (?=x) marked in place
- Capture group table showing group number, name and value; groups that did not participate are left visibly empty
- Replace preview supporting $1, $& and $<name>, always previewed globally
- Individual g / i / m / s / u flag toggles that behave exactly like the JavaScript engine
- ReDoS guard: nested quantifiers and quantified alternations stop execution on long input with an explanation
- Honest limits: input past 100,000 characters, more than 2,000 matches or a scan over 120 ms are all reported
- A cheat sheet of common patterns (email, URL, IPv4, dates, times, CJK, phone numbers, colours, tags) that fills in along with sample text
How to use
- Type your pattern between the slashes and tick the flags you need
- Paste test text on the left — matches highlight as you type
- Enter a replacement string to preview the rewritten text below
- Click a cheat sheet entry to load it and see it work immediately
FAQ
- Why did my pattern return nothing?
- If the text is long and the pattern contains nested quantifiers such as (a+)+ or (\d+\s?)*, the tool stops and tells you. Those patterns backtrack exponentially on long input and would freeze the tab for seconds. Verify with short text first, or rewrite the pattern without nesting.
- Why does it say the global flag is off?
- Without g, JavaScript returns only the first match. That is the engine behaving normally, and the tool reports it rather than quietly adding g — otherwise a pattern that works here would behave differently once pasted into your code.
- Is long input truncated?
- Yes. Past 100,000 characters only the first part is scanned, and the page says so plainly. A synchronous regex cannot be interrupted once it starts, so limiting the input size is the only reliable protection.
- Is my pattern or text uploaded?
- No. Matching and replacing run entirely in your browser, the page makes no network requests, and it keeps working offline.
Related tools
Text Cleaner
TextClean up a column pasted out of a log or spreadsheet: deduplicate, sort, drop blank lines, trim whitespace and strip line numbers, all in your browser.
Text Diff
TextCompare two blocks of text online and highlight added, removed and unchanged lines, so only the lines that changed are marked. Runs in your browser.
Word Counter
TextCount Chinese characters and English words separately, alongside characters, lines, real UTF-8 bytes and reading time. Runs in your browser.
Case Converter
TextConvert identifiers between eight naming styles. Words are split correctly first, so acronyms such as HTTPServer come out right, all in your browser.
Chinese Converter
TextConvert Chinese between simplified and traditional characters, leaning on common words first and the most usual form for the rest, all in your browser.
Markdown Preview
TextWrite Markdown on the left and see it rendered on the right, with pasted HTML shown as text and images never fetched. Runs entirely in your browser.