NHRepon
Home
Services
All ServicesWeb Application DevelopmentMobile Application DevelopmentDigital Marketing and SEO
ProjectsToolsProductsPostsAboutContactLogin
HomeServicesProjectsToolsProductsPostsAboutContact
  • Home
  • Projects
  • Posts
Home/Tools/Developer Tools/Regex Tester
All Tools

Regex Tester

Test a JavaScript regular expression against your own text, with live highlighting, capture groups and a replace preview.

//g
Flags

Matches

0
Enter a pattern above.
Regex cheat sheet
\d
a digit 0-9
\w
a word character: A-Z, a-z, 0-9, underscore
\s
whitespace, including tabs and line breaks
.
any character except a line break
^ / $
start and end of the string (or of a line with the m flag)
a*
zero or more of the preceding token
a+
one or more
a?
zero or one
a{2,5}
between two and five
(?:...)
a non-capturing group
(?<name>...)
a named capture group, read as match.groups.name
[abc]
one character from the set
[^abc]
one character not in the set
a|b
a or b
(?=...)
lookahead β€” must be followed by, but does not consume
(?<=...)
lookbehind β€” must be preceded by

What is a Regex Tester?

A regular expression is a pattern that describes a set of strings. A regex tester runs a pattern against sample text and shows what it matches, where each match starts and what each capture group contains β€” which turns guesswork into a result you can see.

This tester uses the JavaScript engine's own RegExp implementation, so what you see is exactly what `String.prototype.match` and `String.prototype.replace` will do. Flags are toggles rather than typed characters: g finds every match instead of the first, i ignores case, m makes ^ and $ match at each line break, s lets the dot span newlines, u enables Unicode mode with full code-point escapes, and y pins matching to the last index.

Matches are always collected globally for the highlight, so you see every occurrence even when g is off. The match table lists each hit with its index and its capture groups, and the replace box previews what String.prototype.replace would produce, including $1, $2 and $<name> backreferences for named groups.

How to test a regular expression

  1. Type the pattern without the surrounding slashes β€” for a literal dot, write \.
  2. Toggle the flags you need. g is on by default because almost every real task wants all matches.
  3. Paste your test text. Every match is highlighted as you type, and invalid patterns report the engine's own error message instead of failing silently.
  4. Check the match table for the index and capture groups. A group that shows (undefined) means that branch of the pattern did not participate in that match, which is a common source of bugs in code that assumes every group is a string.
  5. Optionally enter a replacement to preview the result. $1 inserts the first group, $& inserts the whole match and $<name> inserts a named group.

Regex Tester limits and rules

Limits, caps and standards referenced by this tool
ItemLimit
EngineThe browser's own ECMAScript RegExp β€” matches yours and Node's behaviour
Flags availableg, i, m, s, u, y β€” the v (Unicode sets) flag is not exposed here
HighlightingAlways global, whatever the g flag says
Match cap1,000 matches per run, to keep a runaway pattern off your main thread
Table rowsFirst 100 matches are listed; the highlight covers them all
LookbehindSupported β€” Node 8.3+ and every current browser
Regex dialectsJavaScript only. PCRE, RE2 and Python differences β€” conditional patterns, \A, atomic groups β€” are not emulated
Catastrophic backtrackingNested quantifiers such as (a+)+ can still freeze the tab; no timeout is imposed

When to use it

  • Writing a validation pattern for an email, phone number, slug or postcode field, and checking the edge cases you can think of before it reaches production.
  • Parsing structured text β€” log lines, CSV rows, semicolon-separated lists β€” and confirming that the capture groups hold the pieces you expect.
  • Debugging a find-and-replace that is matching more than it should, usually a missing escape or an unanchored pattern.
  • Learning regex incrementally against real text rather than abstract examples, with an immediate answer for every change.
  • Verifying an extraction pattern lifted from Stack Overflow actually applies to your data rather than the sample the author had.

Is it private?

Everything runs inside your browser. Your text and files are never uploaded, never stored and never seen by anyone else β€” including me. You can use the tool with the network tab open and watch no request leave the page. Closing the tab erases the input.

Frequently asked questions

Yes. It calls the RegExp constructor of the page's own engine, which is V8 in Chrome and Node, SpiderMonkey in Firefox and JavaScriptCore in Safari. Behaviour is standardised and identical for everything except the newest additions such as the v flag.

Because in a JavaScript string literal a backslash is an escape character, so "\\d" is the two characters backslash and d. The pattern field here takes regex source directly, so you type \d. In code, either double the backslash inside a string or use a literal like /\d/g.

The g flag changes what the engine does when code calls exec repeatedly β€” it continues from lastIndex instead of resetting. Highlighting here always collects every match so the display stays useful, and the flag panel still shows what your code would do with the same pattern.

It can, and this tool does not prevent it: no timeout is imposed, because JavaScript cannot interrupt a running regex. Patterns with nested quantifiers such as (a+)+ against a long non-matching string can backtrack exponentially. Keep test text short while developing a risky pattern.

No. Both the pattern and the test text stay in the page and are compiled locally, so you can paste real log lines or production data without it leaving your machine.

Related tools

  • JSON Formatter
  • Text Diff Checker
  • URL Encoder and Decoder
  • Keyword Density Checker
  • Hash Generator

Written and maintained by Md. Nur Hossain Repon.

NHRepon


Md. Nur Hossain Repon expert in NextJS, React, React Native and Flutter. He is a full-stack web and mobile application developer with 5+ years of experience and a passion for building innovative and robust application. Also, he has a strong background in developing high-quality web and mobile applications using the latest technologies and frameworks.
Let's build something amazing together πŸš€

Quick Links


  • About
  • Projects
  • Services
  • Contact
  • Posts
  • Products
  • Privacy Policy
  • Terms of Service
  • Tools
  • Smart Life Hubs

Newsletter


We respect your privacy. Unsubscribe anytime.

Connect


Β© 2026 NHRepon. All rights reserved.

Build v1.5.4+56.73c4a90