Regex tester
JavaScript (ECMAScript) flavorType a regular expression and some text to see every match, its position and its capture groups (named groups too), and preview a replacement with $1 or $<name>. Uses your browser's JavaScript regex engine.
Fill in the fields to see the result.
How to use it
- Enter the pattern without slashes and the flags (g, i, m, s, u, y).
- Paste the test text; matches update as you type.
- Add a replacement to preview it, then copy the result or download the matches as CSV.
Details
- Flavor
- JavaScript (ECMAScript 2024): lookbehind, named groups, Unicode properties with u or v
- Limits
- Pattern up to 1,000 characters, text up to 100,000, first 500 matches
- Replace
- $1…$9, $<name>, $& (whole match)
Questions
Will a regex that works here work in Python or PHP?
Mostly, for common syntax. Differences include named groups ((?P<name>) in Python), possessive quantifiers and some flags. This tester is JavaScript only.
Why do I only get one match?
Without the g flag a regex stops after the first match. This page always searches globally, so add your own flags for case (i) or multiline anchors (m).
How do I match a literal dot or bracket?
Escape it with a backslash: \. matches a dot, \[ a bracket. Inside a character class, most characters are literal, like [.].
What does the s flag do?
It lets . match line breaks too. Without it, . stops at the end of a line.
Is what I type sent anywhere?
No. The calculation runs in this browser tab with the same code our MCP server uses. Nothing you type is sent to a server or saved, apart from settings like filing status, which stay in this browser.
Can an AI agent use this?
Yes. The same function is a tool on our free MCP server at tools.cuelark.com/mcp, so ChatGPT, Claude or Cursor get exactly the answer this page shows. 'Copy MCP call' gives you the arguments.