Regex tester
Test JavaScript regular expressions against any text — see matches, capture groups, and replacements live, in your browser.
About the Regex tester
Handytool's regex tester lets you build and debug JavaScript regular expressions against any test string in real time. Toggle every flag (g, i, m, s, y, u), see numbered capture groups for each match, and try a replacement template with $1, $2 placeholders side by side. The pattern is evaluated by your browser's native RegExp engine, so what you see here matches exactly what your code will do in production.
Regex tester features
- 01
Live matches and capture groups
Every keystroke re-runs the pattern. Each match shows its index in the input plus all captured groups, so you can confirm structure as you tune the expression.
- 02
All JavaScript flags
Flip g, i, m, s, y, and u individually. Sticky and unicode flags are included so you can reproduce exactly what your application code uses.
- 03
Replacement preview
Type a replacement string with $1, $2, $& and friends to see the substituted output update live — handy for one-off bulk text edits or sanity-checking a complex transform.
Regex tester FAQ
- Which regex flavor does this tester use?
- JavaScript (ECMAScript). Patterns are evaluated by the browser's native RegExp engine, so behavior matches Node.js and any modern browser. Lookbehinds, named groups, and Unicode property escapes (\p{…} with the u flag) are supported.
- Does my pattern or test string leave the page?
- No. Everything runs locally in your browser — no network requests are made when you type a pattern, change flags, or preview a replacement.
- How do I use capture groups in the replacement field?
- Use $1, $2, … to reference numbered capture groups, $& for the whole match, and $$ to insert a literal $. The replacement preview updates live as you change either the pattern or the template.
- Why is my regex not matching across line breaks?
- By default the dot (.) doesn't match newline characters. Enable the s (dot-all) flag, or use [\s\S] to match any character including newlines.
- Does this work for Python or PCRE patterns?
- The engine is JavaScript, so most basic patterns behave identically, but features like (?P<name>…) named groups (Python) or possessive quantifiers (PCRE) are not supported. Use the equivalent JS syntax: (?<name>…) for named groups.
Related tools
Developer →- Live
Diff viewer
Compare two pieces of text side by side — line, word, or character diff — privately in your browser.
DeveloperFreeRuns locallyOpen - Live
Lorem ipsum generator
Generate placeholder text — paragraphs, sentences, or words — instantly, with optional HTML tags.
DeveloperFreeRuns locallyOpen - Live
Slugify
Turn any title into a clean, URL-safe slug — Unicode aware, with separator and stop-word options.
DeveloperFreeRuns locallyOpen
Explore other tools
All tools →- Live
PDF to JPG
Convert each page of a PDF into a sharp JPG, PNG, or WebP image right in your browser — no upload, no quality loss.
PDFFreeRuns locallyOpen - Live
Remove background
Erase the background of a photo using an in-browser AI model — no upload, your images stay on your device.
ImageFreeRuns locallyOpen - Live
Trim Video
Cut the start or end of a video with frame-level precision.
VideoFreeOpen - Live
Trim audio
Cut a section of an audio file.
AudioFreeRuns locallyOpen - Live
Markdown to HTML
Convert Markdown into clean HTML right in your browser.
DocumentFreeRuns locallyOpen