Regex Tester
Write, test and debug JavaScript regular expressions with live matches, groups and replacement previews.
JavaScript Regular Expression Pattern
//gMatch Inspection & Capture Groups
Zero-Based UTF-16 Code-Unit IndicesPractical Regular Expression Presets
Click to auto-load & runNote: These presets are practical developer patterns for exploration and common text extraction. Complex specifications (like RFC 5322 emails or full URL grammars) should be validated with dedicated parsers in production.
Quick JavaScript RegExp Syntax Reference ↓
\d / \D - Digit [0-9] / Non-digit\w / \W - Word char [a-zA-Z0-9_] / Non-word\s / \S - Whitespace / Non-whitespace. - Any char (except newline unless /s)* - 0 or more (greedy)+ - 1 or more (greedy)? - 0 or 1 (optional / lazy modifier){n,m} - Between n and m occurrences^ - Start of string (or line with /m)$ - End of string (or line with /m)\b / \B - Word boundary / Non-boundary(...) - Numbered capturing group(?:...) - Non-capturing group(?<name>...) - Named capturing groupa|b - Alternation (matches a or b)(?=...) - Positive lookahead(?!...) - Negative lookahead(?<=...) - Positive lookbehind(?<!...) - Negative lookbehind\p{L} - Any Unicode letter (with /u)\p{N} - Any Unicode number\p{Emoji} - Emoji characters\P{L} - Non-letter negationHow to Operate Regex Tester
Interactive regular expression testing workbench running the native ECMAScript JavaScript RegExp engine in an isolated Web Worker with an automated 1,000ms ReDoS (catastrophic backtracking) watchdog.
- 1 Enter your regex pattern in the editor without enclosing slashes (e.g. \b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\b).
- 2 Toggle flags (g, i, m, s, u, v, d, y) to customize matching behavior across single-line, multiline, or Unicode modes.
- 3 Paste your test text or drop a plain-text file into the test editor.
- 4 Explore instant highlighted matches, captured and named groups, or switch to Replace and Split modes to preview string transformations.
Example Input & Output
Pattern: \b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\b
Text: Contact us at hello@example.com or support@utilityhub.dev
Match 1: "hello@example.com" (Index: 14, Length: 17) Match 2: "support@utilityhub.dev" (Index: 35, Length: 22)
Supported Inputs
- Standard ECMAScript JavaScript RegExp pattern syntax
- Individually selectable runtime flags (g, i, m, s, u, v, d, y)
-
Numbered capturing groups and named capturing groups (?
...) - Lookahead and lookbehind assertions ((?=...), (?!...), (?<=...), (?
- Unicode property escapes (\p{L}, \p{N}) under Unicode mode
- Plain text strings and uploaded .txt files up to 1 MB
Browser Technical Limits
- Engine executes standard JavaScript (ECMAScript) RegExp; PCRE-specific features (such as recursion or possessive quantifiers) are not supported.
- RegExp execution exceeding 1,000ms is terminated automatically by the worker watchdog to prevent interface freezes.
- Preview highlights and match details are capped at 500 individual matches for smooth browser rendering, while total match counts remain accurate.
- Input test text size is capped at 1 MB for optimal browser memory allocation.
Frequently Asked Questions
Everything you need to know about Regex Tester, formats, and privacy guarantees.
Which regular expression dialect does this tool use?
UtilityHub uses the native JavaScript (ECMAScript) RegExp engine built directly into your web browser. It supports modern JavaScript features including lookbehind assertions, named capture groups, dotAll mode (s), and Unicode property escapes (u/v). Dialect-specific features from PCRE, Python, PHP, or Java (like atomic grouping or recursion) are not part of the JavaScript RegExp specification.
How does UtilityHub protect against Catastrophic Backtracking (ReDoS)?
All regular expression evaluations occur inside an isolated Web Worker supervised by a 1,000ms watchdog timer on the main thread. If a complex or pathological expression causes excessive backtracking, the worker is automatically terminated, freeing system resources and keeping your browser completely responsive.
Why are the "u" and "v" flags mutually exclusive?
In the ECMAScript specification, the "u" (Unicode) flag and the newer "v" (Unicode sets) flag represent different parsing modes for character classes and string properties. JavaScript engines disallow setting both flags simultaneously.
What is the difference between global (g) and sticky (y) matching?
The global flag (g) searches for all occurrences throughout the entire input string from start to end. The sticky flag (y) attempts to match starting strictly at the current lastIndex offset (beginning at index 0); if no match occurs immediately at that index, matching halts.
Which tokens can I use in Replace mode?
Replace mode supports native JavaScript replacement tokens: "$$" for a literal dollar sign, "$&" for the matched substring, "$`" for the text before the match, "$'" for the text after the match, "$1" through "$99" for numbered capture groups, and "$
Are my regex patterns or test texts sent to any server?
No. All regex compilation, match execution, replacement, and splitting happen 100% locally inside your browser via client-side Web Workers. Your data is private and never leaves your machine.