TL;DR — write a regex, paste text, see matches live
Type a pattern, toggle flags, and preview Match, Replace, or Split in real time. See start/end indexes and capture groups, export CSV, and save snippets. Runs 100% in your browser.
Regex Tester – Test and Debug Regular Expressions Online Free (JavaScript)
Test JavaScript regular expressions online with live match highlighting. Supports all flags (g, i, m, s, u), capture groups, named groups, replace and split modes, CSV export, and saved snippets. Type a pattern, toggle flags, and watch matches highlight instantly. Switch tabs to preview Match, Replace, or Split. The matches panel lists each hit with start/end indexes and capture groups, so you can debug quickly without leaving the browser.
Prefer a regex creator feel? Use presets (email, URL, dates, phone, IPv4), read the token‑by‑token explanation, and skim the built‑in cheat sheet. Save your own snippets for reuse or export results to CSV. Everything runs locally with the JavaScript RegExp engine, making this a practical regex checker, editor, and quick builder in one.
Applying patterns to full documents? Try Find & Replace. Extracting web addresses? Use the URL Extractor. Cleaning inputs first? Text Cleaner helps a ton.
Common regex use cases
Regular expressions are useful across many everyday tasks: email validation to check address format, phone number matching across various formats, URL extraction from documents or logs, log parsing to pull timestamps and error codes, find-and-replace patterns for bulk text transformations, and input sanitization to strip or reject unwanted characters before processing.
Quick start
- Enter a pattern (e.g.
/\\w+/gor just\\w+) and toggle flags (g,i,m,s,u,y). Or pick a preset to begin faster. - Paste a test string. Use Match to highlight hits, Replace to preview substitutions (with
$1,$2…), or Split to segment text. - Inspect the Matches table for indexes and groups, export CSV, copy your pattern, or save a named snippet for later.
Key features
- Live Match / Replace / Split previews
- Start & end indexes plus capture groups for each hit
- Token‑by‑token explanation of your pattern
- Presets: email, URL, date, phone, IPv4
- Cheat sheet and user‑saved snippets
- CSV export of matches; one‑click copy of regex and results
- Undo/redo for pattern edits; flag toggles (g/i/m/s/u/y)
- 100% client‑side — fast, private, and offline‑friendly
Tips
- Start simple; add anchors (^, $) and quantifiers gradually.
- Use non‑capturing groups (?: … ) when you don’t need backreferences.
- Prefer explicit character classes over dots when possible.
- Test edge cases: empty lines, Unicode, and newlines (try the s and m flags).
- Beware zero‑length matches; ensure your pattern advances through the string.
Frequently asked questions
Which regex flavor does this use?
Can I use it as an online regex builder?
Why don’t my results match another tester?
dotAll, multiline, Unicode). Double‑check flags and flavor specifics when comparing.Is my data private?
How do I test a regular expression online for free?
How do I match an email address with regex?
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}. Test it against sample addresses to verify edge cases like subdomains and plus-addressing.What does the g (global) flag do in JavaScript regex?
g, the regex stops after the first match. Toggle the flag in the flags bar to see the difference instantly.Can I extract capture groups with this regex tester?
$1, $2, or named references in the replacement string.You might also like
- Apply patterns across whole documents with Find & Replace.
- Extract and decode links using URL Extractor and URL Encoder / Decoder.
- Prep messy inputs before testing with Text Cleaner.