Flowfiles ← Regex Tester

JavaScript Regex Tester Online

Test RegExp patterns live · Flags g i m s u d · Named groups · Replace · Split — free, no signup

Test any JavaScript regular expression online with live color-coded match highlighting. Supports all modern RegExp features: character classes, quantifiers, anchors, capturing groups, named groups, lookaheads, and lookbehinds. Everything runs natively in the browser.

Open the tester and start immediately — no account, nothing stored on any server.

Open the Regex Tester →

Testing a JavaScript regex online

The JavaScript RegExp engine supports all modern features. Common methods for using regex in JS code:

const re = /\d{4}-\d{2}-\d{2}/g;
const text = 'Ship 2024-03-15, return 2024-04-01';

// All matches with matchAll (ES2020)
for (const m of text.matchAll(re)) {
  console.log(m[0], 'at index', m.index);
}

// Quick test
/^\d{4}-\d{2}-\d{2}$/.test('2024-01-01'); // → true

// Replace
text.replace(/\d{4}-\d{2}-\d{2}/g, '[DATE]');
// → "Ship [DATE], return [DATE]"

Frequently asked questions

What is the difference between greedy and lazy quantifiers?

Greedy quantifiers (*, +, {n,m}) match as many characters as possible. Lazy quantifiers (*?, +?, {n,m}?) match as few as possible. Example: <.*> matches the entire <b>text</b> (greedy), while <.*?> matches only <b> (lazy).

What is the s (dotAll) flag?

By default, . does not match newline characters (\n, \r). The s flag (ES2018) makes . match any character including newlines, which is useful when matching patterns that span multiple lines.

When should I use the u flag?

Use u for any pattern involving non-ASCII characters, emoji, or Unicode property escapes (\p{Letter}). It also enforces strict escaping, catching typos like invalid escape sequences that the engine would otherwise silently ignore.

Related tools