Regex TesterLive JavaScript RegExp debugger
en

AppHelp

Test and debug JavaScript regular expressions

See matches as you type, inspect indexes and capture groups, verify positive and negative cases, preview replacements, and copy a safe JavaScript snippet.

JavaScript regex workspace

Build against the browser JavaScript RegExp engine with live highlights, tests, replacement, and generated code.

Runs locally
Flags

Live match preview

/(?<user>[A-Z0-9._%+-]+)@(?<domain>[A-Z0-9.-]+\.[A-Z]{2,})/gi

2 matchesValid
Contact ada@example.com or support@apphelp.net. Invalid: person@example.
Match 1[8, 23) · 15 characters
ada@example.com
$1ada
$2example.com
userada
domainexample.com
Match 2[27, 46) · 19 characters
support@apphelp.net
$1support
$2apphelp.net
usersupport
domainapphelp.net
.

Any character except a line break

\d / \w / \s

Digit, word, and whitespace classes

* + ?

Zero or more, one or more, optional

{2,5}

Repeat from 2 through 5 times

^ $

Start and end anchors

(...) / (?:...)

Capturing and non-capturing groups

(?<name>...)

Named capture group

(?=...) / (?!...)

Positive and negative lookahead

Common tasks

  • regex tester
  • regular expression tester
  • javascript regex tester
  • regex debugger online
  • regex match highlighter
  • regex replace tester
  • regex capture groups
  • regex unit tests
  • regex101 alternative javascript
  • free regex tester online

Quick answer

Enter a JavaScript regular-expression pattern, select explicit flags, and paste test text. AppHelp compiles the pattern with the browser RegExp engine, highlights each JavaScript match, reports index ranges and capture groups, previews replacement tokens, runs positive and negative line-based tests, and generates a safely escaped constructor snippet. Other engines such as PCRE, Python, Java, .NET, and RE2 can behave differently.

How to use

  1. 1. Enter a JavaScript patternType the pattern without surrounding slashes. Choose flags separately so duplicate or unsupported flags cannot be introduced accidentally.
  2. 2. Inspect highlighted matchesPaste representative text and review every visible match, its half-open index range, numbered groups, named groups, and any zero-length marker.
  3. 3. Verify replacement and testsUse JavaScript replacement tokens such as $1 or $<name>, then add one expected positive or negative case per line.
  4. 4. Copy implementation codeOpen the JavaScript tab and copy the RegExp-constructor snippet, then review performance and engine compatibility before production use.

Examples

Named email groups

Input
(?<user>[A-Z0-9._%+-]+)@(?<domain>[A-Z0-9.-]+\.[A-Z]{2,}) / gi
Output
Matches email-like text and exposes user and domain groups.

ISO date parts

Input
\b(?<year>\d{4})-(?<month>0[1-9]|1[0-2])-(?<day>0[1-9]|[12]\d|3[01])\b / g
Output
Captures year, month, and day from YYYY-MM-DD candidates.

This checks numeric shape, not calendar validity such as February 31.

Repeated word

Input
\b(?<word>\w+)\s+\k<word>\b / gi
Output
Finds adjacent repeated words such as is is.

Common use cases

  • Debug validation patterns before adding them to a form
  • Inspect captures used by parsers, log processors, and migrations
  • Preview find-and-replace operations before changing text or code
  • Turn bug examples into positive and negative regression cases
  • Generate a safely escaped JavaScript RegExp constructor

Edge cases

  • Without the global g flag, JavaScript returns only the first match and replacement normally affects only that occurrence.
  • Zero-length global matches require the cursor to advance manually; the tool marks them with an arrow and guards against infinite loops.
  • Regular expressions can validate shape without validating domain rules, calendar dates, reachable URLs, or real email delivery.
  • Nested ambiguous quantifiers can cause catastrophic backtracking on hostile input; benchmark and constrain production patterns.
  • Lookbehind, Unicode properties, flags, and replacement tokens differ across JavaScript, PCRE, Python, Java, .NET, and RE2.
  • The tester caps displayed matches and input length to protect browser responsiveness.

Features

  • Live JavaScript RegExp validation and highlighted matches
  • Index ranges, numbered captures, named groups, and zero-length match markers
  • Explicit g, i, m, s, u, y, and d flag controls
  • Replacement template preview using JavaScript replacement semantics
  • Positive and negative test cases with pass/fail summaries
  • Email, URL, IPv4, ISO date, hex color, and repeated-word presets
  • Copyable JavaScript constructor snippet and quick-reference cards
  • Browser-local processing with a match cap for responsiveness

Frequently asked questions

Which regular-expression engine does this tool use?
It uses the JavaScript RegExp engine built into your browser, so results match that browser rather than PCRE, Python, Java, .NET, or RE2.
What do the g and i flags do?
g continues through all matches; without it only the first match is returned. i makes letter matching case-insensitive.
Can I inspect named and numbered capture groups?
Yes. Each match card shows $1, $2, and later captures plus any groups declared with the (?<name>...) syntax.
How do replacement tokens work?
The preview uses JavaScript String.replace semantics, including $1 for a numbered group and $<name> for a named group.
Why does the tool show a zero-length match marker?
Some patterns match a position rather than characters. The marker makes that invisible result inspectable and the loop advances safely.
Do passing tests prove the regex is safe?
No. Tests cover only the cases entered. Review false positives, false negatives, engine support, and worst-case performance separately.
Is my test text uploaded?
No. Compilation, matching, replacement, tests, and code generation all happen locally in your browser.