Validate JSON and pinpoint errors by line and column — including duplicate keys that most parsers ignore.
Regex Tester
Test JavaScript regular expressions with live highlighting, capture groups and replace.
Runs in your browser — nothing you enter is sent to our servers
How it works
Your pattern and flags are compiled with JavaScript’s RegExp. Matching runs in a background Web Worker with a 1.5-second limit, so a runaway pattern can’t lock up the page. Matches are highlighted in the test string, and the table lists each match’s position with its numbered and named capture groups. The replace box uses String.prototype.replace with the same pattern.
Quick reference
\d \w \s | digit, word character, whitespace (capitals negate: \D \W \S) |
|---|---|
. ^ $ | any character, start, end |
* + ? {2,4} | 0+, 1+, 0 or 1, between 2 and 4 (add ? to make lazy) |
[abc] [^abc] | any of / none of a, b, c |
(…) (?:…) (?<name>…) | capture group, non-capturing group, named group |
(?=…) (?!…) | lookahead, negative lookahead |
Example
The pre-filled pattern matches South African phone numbers written as 082 123 4567 or 021-555-0199, capturing the area code as a named group. The replacement ($<area>) $2-$3 reformats them as (082) 123-4567 and (021) 555-0199. The “invalid” number doesn’t match.
Frequently asked questions
Which regex flavour does this use?
JavaScript (ECMAScript) regular expressions, as built into your browser. Most syntax is shared with other languages, but some features — such as possessive quantifiers or certain lookbehind rules — differ in PCRE, Python or .NET.
What do the flags mean?
g = find all matches (not just the first); i = ignore case; m = ^ and $ match at line breaks; s = . also matches line breaks; u = Unicode mode (needed for \p{…} classes and emoji); y = sticky (match only at the current position).
Why did my pattern time out?
Some patterns, such as nested quantifiers like (a+)+, can take exponentially long on certain inputs (“catastrophic backtracking”). The tester runs in a background worker and stops after 1.5 seconds so your browser doesn’t freeze. Simplify the pattern or make it more specific.
Related tools
Convert text to UPPERCASE, lowercase, Title Case, Sentence case, camelCase, snake_case and more.
Generate random v4 or time-ordered v7 UUIDs in bulk, in the format you need.
Pretty-print or minify JSON with your choice of indentation and optional key sorting.
Related guides
A practical regex guide for JavaScript developers
The regular expression syntax you'll actually use in JavaScript — character classes, groups, lookarounds, flags and replacements — with examples you can try.
CSS colour formats explained: HEX, RGB, HSL, HWB and OKLCH
What each CSS colour format means, when to use it, why OKLCH is useful for palettes, and how to check colour contrast for accessibility.
JWTs explained: structure, claims, decoding vs verifying, and common mistakes
How JSON Web Tokens work, what each part and claim means, why decoding isn't verifying, and the mistakes that cause real security bugs.