Interactive Developer Utility / ECMAScript RegExp

JavaScript Regular Expression Tester

Test and debug JavaScript regular expressions in real time. Inspect full matches, numbered and named capturing groups, character offsets, line/column coordinates, and String.replace() transformations directly in your browser.

Engine
Native ECMAScript RegExp
Execution
100% Client-Side (Zero Latency)
Historical Heritage
REJAX (Aphex Creations, 2007)
Licence / Cost
Free Public Utility
REJAX Engine / Live ECMAScript RegExp3 matches found (0 ms)
Load Pattern Preset:
//gid
170 chars · 3 lines
Live Match Highlighting3 highlighted regions
Primary: https://www.webdevawards.org/tools/regex-tester Archive: https://www.webdevawards.org/resources/aphex-creations Legacy: http://projects.aphexcreations.net/rejax/
Match #1Index 9–56 (len 47) · Line 1, Col 10
Full Match ($&):
https://www.webdevawards.org/tools/regex-tester
Capture Groups:
$1: "https"
[9..14]
$2: "www.webdevawards.org"
[17..37]
$3: "/tools/regex-tester"
[37..56]
Named Groups (match.groups):
$<protocol>: "https"
$<host>: "www.webdevawards.org"
$<path>: "/tools/regex-tester"
Match #2Index 66–120 (len 54) · Line 2, Col 10
Full Match ($&):
https://www.webdevawards.org/resources/aphex-creations
Capture Groups:
$1: "https"
[66..71]
$2: "www.webdevawards.org"
[74..94]
$3: "/resources/aphex-creations"
[94..120]
Named Groups (match.groups):
$<protocol>: "https"
$<host>: "www.webdevawards.org"
$<path>: "/resources/aphex-creations"
Match #3Index 129–170 (len 41) · Line 3, Col 9
Full Match ($&):
http://projects.aphexcreations.net/rejax/
Capture Groups:
$1: "http"
[129..133]
$2: "projects.aphexcreations.net"
[136..163]
$3: "/rejax/"
[163..170]
Named Groups (match.groups):
$<protocol>: "http"
$<host>: "projects.aphexcreations.net"
$<path>: "/rejax/"
01 / Workflow Guide

How to Use the JavaScript Regex Tester

This utility evaluates regular expressions directly against your browser’s native JavaScript RegExp runtime, ensuring that every pattern behaves identically to production Node.js, Cloudflare Workers, Deno, and modern browser environments.

  1. Enter a Regular Expression Pattern: Type your expression between the forward slashes (/.../) without enclosing delimiters, or click one of the Pattern Presets above to load a working example.
  2. Configure Expression Flags: Toggle flags such as g (global), i (case-insensitive), m (multiline), s (dotAll), u (Unicode), or d (capture group indices) using the interactive flag bar.
  3. Inspect Matches & Capture Groups: Paste your multiline sample text. Matched substrings are highlighted immediately, and the Matched Groups & Positions panel displays the exact character start/end indices, line/column numbers, numbered sub-groups ($1, $2), and named capture groups (match.groups).
  4. Test Replacements & Export Code: Switch to the String.replace() Preview tab to test substitution tokens ($&, $1, $<name>), or use the top toolbar buttons to copy the regex literal, ready-to-run JavaScript snippet, or structured JSON match array.

Need a deeper syntax walkthrough? Read our companion JavaScript Regex Guide: Syntax, Examples & Patterns.

02 / Pattern Library

Common JavaScript Regex Examples

Below are battle-tested regular expressions frequently used in frontend validation, server-side routing, and log parsing. You can load most of these directly using the preset buttons inside the tester above:

Use CasePattern & FlagsNotes
Standard Email Format/\b([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})\b/gCaptures username in $1 and domain in $2.
HTTPS/HTTP URL with Named Groups/(?<protocol>https?):\/\/(?<host>[a-z0-9.-]+)(?<path>\/[^\s]*)?/giPopulates match.groups.protocol, host, and path.
ISO 8601 Date (YYYY-MM-DD)/\b(?<year>\d{4})-(?<month>0[1-9]|1[0-2])-(?<day>0[1-9]|[12]\d|3[01])\b/gRestricts months to 01–12 and days to 01–31.
IPv4 Address/\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b/gUses non-capturing groups (?:...) to validate 0–255 octets.
First File in a Multi-Part RAR Archive/^(?<basename>.+?)(?:\.part0*1\.rar|(?<!\.part\d+)\.rar)$/gimUses negative lookbehind (?<!\.part\d+) so standalone .rar and .part01.rar match while .part02.rar is ignored.
Semantic Version (SemVer 2.0)/^v?(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>[0-9A-Za-z.-]+))?(?:\+(?<build>[0-9A-Za-z.-]+))?$/gmParses major, minor, patch, pre-release, and build metadata.
03 / ECMAScript Specification

Supported Regular Expression Flags

Modern JavaScript engines support eight regular expression flags that modify how patterns are compiled and executed:

g — Global Search

Finds all matches across the input string rather than returning after the first match. Required when calling String.prototype.matchAll().

i — Ignore Case

Makes pattern matching case-insensitive (/[a-z]/i matches both a–z and A–Z).

m — Multiline Mode

Changes ^ and $ so they match the beginning and end of each line (delimited by \n or \r) instead of only the start and end of the entire string.

s — DotAll (Singleline)

Allows the dot metacharacter (.) to match line terminators (\n, \r, \u2028, \u2029).

u — Unicode Mode

Treats astral Unicode surrogates as complete code points and unlocks Unicode property escapes such as \p{Letter} and \p{Emoji}.

d — Match Indices (hasIndices)

Attaches an indices array to exec() results containing the exact [start, end] character offsets for every captured sub-group.

y — Sticky Search

Anchors matching strictly to the current regex.lastIndex position without scanning forward—ideal for lexical tokenisers.

v — Unicode Sets (ES2024)

Upgrades u mode with set intersection (&&), subtraction (--), and multi-character string properties inside character classes.

04 / Sub-Expressions & Assertions

Capturing Groups, Named Groups & Lookarounds

Parentheses in JavaScript regular expressions serve two distinct purposes: grouping quantifiers/alternations and extracting matched sub-strings for inspection or replacement.

Numbered vs Named Capturing Groups in JavaScript (javascript)
const logLine = "2026-10-12T22:45:10Z [ERROR] Worker timeout after 1500ms";
const pattern = /^(?<timestamp>\S+) \[(?<level>INFO|WARN|ERROR)\] (?<message>.+?) \((?<ms>\d+)ms\)|^(?<ts>\S+) \[(?<lvl>INFO|WARN|ERROR)\] (?<msg>.+)$/;

const urlPattern = /(?<protocol>https?):\/\/(?<host>[^/]+)(?<path>\/.*)?/d;
const match = urlPattern.exec("https://www.webdevawards.org/tools/regex-tester");

if (match) {
  console.log(match[0]);              // Full match
  console.log(match[1]);              // "https" (Numbered Group $1)
  console.log(match.groups.host);     // "www.webdevawards.org" (Named Group)
  console.log(match.indices.groups);  // { protocol: [0, 5], host: [8, 28], path: [28, 47] }
}
  • Capturing Group (pattern): Captures the matched substring into numbered slots (match[1], match[2]) and allows backreferences inside the pattern via \1, \2.
  • Named Capturing Group (?<name>pattern): Assigns a semantic identifier accessible on match.groups.name, backreferenced via \k<name>, and referenced in replace() via $<name>.
  • Non-Capturing Group (?:pattern): Groups tokens for quantifiers or alternation (e.g., (?:http|https)) without allocating memory in the capture array.
  • Lookahead & Lookbehind Assertions: Zero-width assertions that verify surrounding text without consuming characters: positive lookahead (?=...), negative lookahead (?!...), positive lookbehind (?<=...), and negative lookbehind (?<!...).
05 / Archival Provenance / February 2007

The Historical REJAX Connection

In February 2007, software developer Brendon Crawford launched REJAX at http://www.projects.aphexcreations.net/rejax/ (and projects.aphexcreations.net/rejax) under the Aphex Creations banner. Described across developer bookmarking communities as “rejax - easiest regular expression tester. ever.” and “rejax - coolest regular expression tester. ever.”, REJAX was one of the first developer tools to demonstrate that complex regular expression debugging could run entirely inside the browser DOM without server-side round-trips.

Over nearly two decades, REJAX was cited by Ajaxian, phpspot, KickJava, Xmarks, Diigo JavaScript Online Tools, and the Gouvernement du Québec WebMaestro portal (as a reference testeur d’expressions régulières). When the historical Aphex Creations domain was retired and migrated into the Web Dev Awards developer resources archive, preserving a fast, zero-advertisement, interactive JavaScript regular expression tester at this destination was our top priority so every historical link continues to serve working code.

06 / Frequently Asked Questions

JavaScript Regular Expression FAQ

How does this JavaScript regex tester evaluate patterns?
The tester uses your browser's native ECMAScript RegExp engine in real time. No test strings or regular expressions are transmitted to an external server, guaranteeing instant zero-latency evaluation and complete privacy for sensitive log files or payloads.
Why does my pattern only return one match instead of all occurrences?
In JavaScript, RegExp.prototype.exec() and String.prototype.match() stop after the first match unless the global (g) flag is enabled. Toggle the 'g' flag in the toolbar above to iterate through every match in your multiline sample text.
What is the difference between numbered capture groups and named capture groups?
Numbered capture groups use standard parentheses like (\d{4}) and are accessed by index (match[1], $1). Named capture groups use the (?<year>\d{4}) syntax introduced in ES2018 and populate the match.groups.year object property as well as $<year> in replacement strings.
What happened to the original REJAX regular expression tester?
REJAX (originally hosted at projects.aphexcreations.net/rejax/ by Brendon Crawford at Aphex Creations in 2007) was one of the web's earliest live browser-based JavaScript regular expression testers. Web Dev Awards built and maintains this modern, dependency-free JavaScript Regex Tester as a permanent functional replacement for historical REJAX bookmarks.
How do I match across multiple lines including newline characters?
Enable the 'm' (multiline) flag if you want ^ and $ anchors to match the start and end of individual lines rather than the entire string. Enable the 's' (dotAll) flag if you want the dot metacharacter (.) to match newline characters (\n and \r).
Connected Reference & Utilities