RegexEditor.dev Logo

Regex Editor & Tester

JavaScript Regex Tester

Test ECMAScript regular expressions with spec-accurate behavior — named groups, lookbehind, and flag semantics.

Free, no signup — runs entirely in your browser on RegexEditor.dev.

/
/

Test your JavaScript regex in the editor below

JavaScript regex: what makes it different

ES2018+ lookbehind
(?<=…) and (?<!…) work in all modern engines but fail in older ones — know your support matrix.
Named groups
(?<year>\d{4}) with result.groups.year — no Python-style P required.
Unicode mode /u
Without /u, \p{L} matches the literal letters "p{L}"; with /u it becomes a Unicode property escape.
/d flag indices
The /d flag adds start/end indices for every group — essential for syntax highlighting use cases.

JavaScript's regex flavor (ECMAScript) is what every browser-based tester runs — but the details matter: named capture groups (?<name>…), the /d flag for match indices, lookbehind (only added in ES2018), Unicode property escapes \p{…} with the /u flag, and the /s (dotAll) flag all change behavior in ways older simulators get wrong.

This tester runs the ECMAScript engine your browser ships, and shows group-by-group results, replacement previews, and a step-by-step explanation of what your pattern actually says.

JavaScript regex FAQ

Does JavaScript regex support lookbehind?

Yes, since ES2018: (?<=…) and (?<!…) are supported in all evergreen browsers and Node.js. They are fixed-width only — unlike .NET, variable-length lookbehind is not allowed.

What does the /u flag do in JavaScript regex?

It switches the pattern into full Unicode mode: \p{…} property escapes work, surrogate pairs are treated as single characters, and some previously tolerated escapes become errors. Without /u, patterns match UTF-16 code units, which can split emoji.

Is JavaScript regex the same as PCRE?

No. JavaScript lacks recursion and (until recently) atomic groups and possessive quantifiers, and its Unicode class syntax differs. Patterns portable between the two are usually the simple ones — test both flavors here before reusing a pattern across languages.