Regex Tester (JavaScript)
Test JavaScript regular expressions with highlighted matches, numbered and named groups and a replace preview. Patterns that run too long (ReDoS) are stopped automatically.
- Runs in your browser (no upload)
No surrounding slashes. Examples: \d+, (?<year>\d{4})
You can use $1, $<name>, $& (whole match) and $$ (a literal $).
Patterns up to 1,000 characters, test strings up to 100,000 characters. Runs longer than 1 s are stopped automatically.
Running…
How to use
- Enter a pattern and choose flags such as g, i or m.
- Type a test string: matches are highlighted and listed with their positions and groups.
- Enter a replacement (with $1, $<name> and so on) to preview and copy the replaced text.
FAQ
Which regex engine is used?
Your browser's JavaScript engine (RegExp). Some syntax and behavior differ from PCRE, Python or Java.
Can a bad pattern freeze the page?
No. Matching runs in a separate Web Worker; if it takes longer than 1 second the worker is stopped and you see a "took too long" message, even for catastrophic backtracking such as ^(a+)+$.
What about patterns that match an empty string?
After an empty match the search moves on to the next position (by whole characters with the u or v flag), so it never loops forever.
Notes & limitations
- What you enter is processed only on this page and is not sent to YUCTS servers.
- Patterns are limited to 1,000 characters and test strings to 100,000 characters. Only the first 1,000 matches are highlighted and listed.
- Available syntax and flags (such as v and d) depend on your browser version; unsupported flags are disabled.
- The 1-second limit depends on device speed, so a slow device may stop an ordinary pattern too.
- Safari (JavaScriptCore) stops a search by itself after too much backtracking and reports "no match". This tool warns about slow runs but cannot tell whether such a result is correct.
Data sources
- ECMAScript Language Specification: RegExp (Regular Expression) Objects(opens in a new tab) — Checked on: 2026-10-31
- OWASP: Regular expression Denial of Service (ReDoS)(opens in a new tab) — Checked on: 2026-10-31
Related tools
- JSON Formatter & ValidatorValidate JSON and see the exact line and column of any syntax error. Pretty-print with 2 or 4 spaces or tabs, minify, sort keys, then copy or download.
- CSV ⇄ JSON ConverterConvert CSV or TSV to JSON and JSON back to CSV or TSV. Handles quoted fields, line breaks in cells, UTF-8 BOM, delimiter detection and Shift_JIS, and lets you pick, reorder and rename columns.
- YAML ⇄ JSON ConverterConvert YAML to JSON and JSON to YAML safely: custom or executable tags are never loaded, alias expansion is limited, and errors show the line and column.
- Base64 Encoder & Decoder (Text and Files)Encode text (including emoji and any language) to Base64 as UTF-8 and decode it back. Supports URL-safe Base64, optional padding, files and data URLs.
- URL Encoder & Decoder (Percent-Encoding)Percent-encode or decode URLs and query strings in any language with encodeURIComponent, encodeURI or form encoding (+). Broken % sequences show the exact error position.
- Unix Timestamp ConverterConvert Unix timestamps to dates and dates to timestamps. Seconds, milliseconds, microseconds or nanoseconds, ISO 8601 with IANA time zones, values past 2038 and negative values before 1970.