100% local processing — your files and data never leave this browser. No uploads, no server storage.

OnboxTools

Free · Browser-only · No upload

Regex tester online — test regular expressions live

JavaScript regex checker with matches, groups, and flags

Use this regex tester online to test regular expression patterns against sample text before you ship validators, log parsers, or search-and-replace rules. Set flags, run a regex test, and inspect every match index plus capture groups — all in your browser with no upload.

The engine is JavaScript RegExp, the same dialect as browsers and Node.js. That makes this an accurate javascript regex test bench when your code runs on the web stack. Patterns and sample strings never leave your device.

Pattern & flags

//g
Quick samples
Test string
Match results
Matches0
EngineJavaScript
Flagsg

More Text Utilities

🔓
Base64 Decoder
🧬
Base64 Encoder
🔡
Case Converter
Cron Generator
🎨
CSS Minifier
📐
CSS Unminifier
📆
Date Format Converter
📅
Date to Unix
🔎
Find and Replace
🛡️
HTML Escape
📰
HTML Minifier
↩️
HTML to Markdown
🔓
HTML Unescape
📄
HTML Unminifier
📋
Markdown Preview
🔄
Markdown to HTML
🎲
Random Number
🔤
Random String
🔍
Regex Tester
🧹
Remove All Whitespace
↩️
Reverse Text
✂️
Split String
⚖️
Text Compare
🔁
Text Repeater
📖
Text Viewer
🌍
Time Zone Converter
🕐
Unix Time to Date
🔗
URL Encoder
🔤
UTF-8 Decoder
🌐
UTF-8 Encoder
📊
Word Counter

Browse by category

Common JavaScript regex building blocks

Start with anchors for whole-string checks, add character classes for allowed symbols, then layer quantifiers for repetition. In JavaScript: const re = new RegExp(pattern, flags) or /pattern/flags literals — this tester uses the same constructor under the hood.

/^\d{4}-\d{2}-\d{2}$/ // date-shaped token (add stricter checks in production)

Worked example: matching phone-shaped tokens

Pattern \d{3}-\d{2}-\d{4} with flag g on sample text 111-22-3333 and 444-55-6666 returns two matches at indices 0 and 16. Without g, only the first social-style segment appears — a common surprise when developers expect a javascript regex match tester to list every hit.

Add a capture group (\d{3})-(\d{2})-(\d{4}) to see three groups per match. That preview helps before you wire $1-$2-$3 into String.replace.

JavaScript RegExp flags reference

FromToResult
gGlobalAll matches
iIgnore caseA matches a
mMultiline^/$ per line
sDotAll. matches \n
uUnicode\p{...} support
yStickyAnchored to lastIndex

Complete guide to testing regular expressions online

What an online regex tester does

A regex tester online lets you write a pattern, paste a test string, and see whether the engine finds matches — without opening an IDE or deploying code. This page acts as an online regular expression tester and lightweight regex debugger online: you get match positions, captured groups, and syntax errors in one view.

Regular expressions compress complex text rules into short patterns, but small edits can change behavior dramatically. Live feedback catches off-by-one anchors, greedy quantifiers that swallow too much, and flag combinations that silently change results.

Treat this as a regex pattern tester for iteration, not a regex generator online that invents patterns from examples. You bring the pattern; the tool validates and explains what it matched.

Because processing stays client-side, you can safely test regular expression logic on production log excerpts, customer emails, or internal identifiers without sending data to a server.

How to run a regex test on this page

Type your pattern between the slash delimiters shown in the UI — do not include the outer / characters in the input field. Toggle flags with the g, i, m, s, u, and y buttons, then paste or import a test string and click Run regex test.

The results panel lists each match with its start index and any capture groups from parentheses. Without the global flag, you see only the first match; enable g when you need every occurrence, which is the usual javascript regex test online workflow for scanners and validators.

Quick sample buttons load common starting patterns for emails, digits, URLs, and whitespace. Replace them with your real pattern and keep a small library of strings that historically broke your regex — rerun them after every tweak.

Copy match output when you need to attach evidence to a ticket or compare results across pattern versions during code review.

JavaScript RegExp flags and syntax

Flag i makes matching case-insensitive. Flag m changes ^ and $ so they anchor to each line in multiline text instead of only the string ends. Flag g finds all matches instead of stopping at the first — essential for counting tokens or highlighting every hit.

Flag s (dotAll) lets the dot metacharacter match newline characters, which matters when parsing multiline logs. Flag u enables better Unicode handling for letters outside Basic Latin. Flag y enables sticky matching that resumes from lastIndex.

Anchors ^ and $ bound the start and end (per line when m is set). Shorthand classes like \d, \w, and \s match digits, word characters, and whitespace. Quantifiers ?, *, and + repeat the previous atom; {n,m} sets explicit bounds.

Capturing groups (...) store substrings for replacement or inspection. Non-capturing (?:...) groups group without adding to the groups list. Lookaheads (?=...) and lookbehinds (?<=...) assert context without consuming characters when your browser supports them.

JavaScript vs Python, Java, and other engines

This tool is a javascript regex tester online — not a python regular expression tester, java regex tester, or c# regex online sandbox. ECMAScript RegExp shares much syntax with PCRE, but details diverge: word boundaries, lookbehind width rules, and Unicode property escapes differ by runtime.

If you also target Python re, Java Pattern, Ruby, PHP preg, or .NET, validate critical patterns in those environments too. A pattern that passes a js regex test here may need tweaks for nginx regex test rules or elasticsearch regex tester filters where engines are more PCRE-like.

When porting from stack-overflow snippets, check whether the answer assumed Java, Perl, or JavaScript. Drop the delimiters and engine-specific flags, then re-test here before pasting into your codebase.

For language-specific cheat sheets and tutorials, use official docs alongside this regex online validator — the goal here is fast match inspection, not replacing full documentation.

Debugging patterns and avoiding pitfalls

Greedy quantifiers like .* consume as much text as possible. If a pattern misses inner tokens, try lazy .*? or a narrower class such as [^\n]* for line-based logs. That debugging loop is what people mean by regex learn build and test regex workflows.

Nested quantifiers on long input can cause catastrophic backtracking and freeze the tab. Test on representative excerpts first; narrow character classes beat nested .* chains on megabyte strings.

Syntax errors — unclosed brackets, invalid escapes, or unsupported constructs — surface before matching runs. Read the error message, fix the pattern, and rerun.

False negatives often trace to hidden characters: trailing newlines, non-breaking spaces, or Windows \r\n line endings. Paste a smaller substring to isolate which segment fails.

Practical workflows and related tools

Extract IDs from log lines, validate obvious email typos, pull tokens from CSV exports, or prototype input masks before wiring them into React or Node. Pair results with your editor's find-and-replace when you need literal bulk substitution instead of pattern matching.

Use capture groups to preview what String.replace would emit with $1, $2, or named $<group> references in modern JavaScript. Test named groups here before embedding them in production code.

For bulk literal edits across many files, open our Find and Replace tool. For encoding extracted tokens, use Base64 Encoder or URL Encoder after you confirm the regex matched the right substrings.

Clear the panels when finished on shared computers. Nothing persists after you close the tab.

Detailed guide

Debugging why .* matched too much

Greedy .* runs to the last possible position in the string. Switch to lazy .*? or replace .* with [^>]* when parsing HTML-like fragments.

Split the sample into halves to find which segment triggers the overrun, then tighten the pattern before testing on the full file again.

Testing before a javascript regex test in production

Paste the exact pattern from your pull request, enable the same flags your code passes to new RegExp, and import a failing customer string if you have one.

Compare match indices here against console.log(str.match(re)) in devtools — mismatches usually mean different flags or accidental double-escaping in string literals.

Common questions

Regex Tester FAQ

How do I test regular expression patterns online?

Enter your pattern, set flags, paste a test string, and click Run regex test. The results panel shows each match index, matched text, and capture groups.

Is this a javascript regex tester or PCRE?

JavaScript RegExp (ECMAScript) — the same engine as browsers and Node.js. Syntax is similar to PCRE, but Python, Java, and .NET patterns may need adjustment.

Why does my regex test show zero matches?

Check flags: without g you only see the first match. Verify ^/$ anchors with the m flag on multiline text, and confirm the sample has no unexpected whitespace.

What is the difference between a regex checker and a regex generator?

Generators propose patterns from examples. This page is a regex evaluator and regex online matcher — you write the pattern and inspect matches.

Can regex testing hang my browser?

Pathological patterns on very long strings can stutter due to catastrophic backtracking. Test shorter excerpts first.

Is my test data uploaded?

No. Patterns and sample text stay in your browser until you close or refresh the page.

Does the Regex Tester send my input to a server?

Yes. Everything runs in your browser. Your input is not uploaded, logged, or stored on our servers.

Do I need an account?

No account or sign-up is required. Open the page and start using the tool immediately.