UltKit

Regex Tester

Type a pattern, tick the flags you need and paste some text: every match is highlighted as you type and listed with its position and capture groups. The pattern runs on your browser's own JavaScript regex engine, so results match your code and the text stays on your device.

Flags

0 characters · 0 words · 0 lines

Matches are highlighted here.

0 characters · 0 words · 0 lines

Runs entirely in this browser tab. Your text is never uploaded or stored.

JavaScript regex tokens

The first-match column was produced by running each pattern on its text with the JavaScript engine that built this page.

TokenMeaningPatternTextFirst match
\dDigit 0–9/\d+/Order 66 shipped66
\wLetter, digit or underscore (ASCII)/\w+/snake_case-idsnake_case
\sWhitespace, including tabs and line breaks/\s+/two spaces
.Any character except a line break (unless s)/a.c/abc a-cabc
^ $Start and end of input (or line, with m)/^\w+$/singlesingle
[abc]One of the listed characters/[aeiou]/rhythm and bluesa
[^abc]Any character not listed/[^0-9]+/2026-10-18-
* + ?0 or more, 1 or more, 0 or 1/colou?r/color colourcolor
{n,m}Between n and m times/\d{2,4}/7 42 1999 12345642
(…)Capturing group/(\d+)px/width: 320px320px
(?<name>…)Named capturing group/(?<h>\d\d):(?<m>\d\d)/at 09:4509:45
(?:…)Group without capturing/(?:ab)+/ababab!ababab
a|bEither side/cat|dog/hotdogdog
\bWord boundary/\bcat\b/concat catcat
(?=…)Followed by (lookahead)/\d+(?=%)/50 of 75%75
(?<!…)Not preceded by (negative lookbehind)/(?<!\$)\b\d+/$30 or 4040
\p{L}Any Unicode letter (needs u)/\p{L}+/unaïve 東京naïve

The six flags and what they change

g (global) finds every match instead of stopping at the first; without it the list holds one entry. i ignores case. m (multiline) makes ^ and $ match at the start and end of each line rather than only of the whole text, which is what you want for a pattern like trailing spaces. s (dotAll, added in ES2018) lets . match line breaks too. u (unicode) treats text as code points, so an emoji counts as one character, and enables property escapes such as \p{L} for any letter in any script. y (sticky) only matches exactly at the current position, the mode tokenizers use. JavaScript also has d for match indices and v for set operations in classes; this tester sticks to the six above.

Under the test text, each match shows its index and its groups. Numbered groups come from plain parentheses, (?:…) groups without capturing, and (?<year>\d{4}) creates a named group that appears by name, as the ISO date sample demonstrates. The Common patterns menu inserts tested starting points for email addresses, URLs, IPv4 addresses, hex colors, UUIDs, repeated words and trailing spaces. Treat the email pattern as a sanity check, not validation: the full address grammar is far more permissive, and the only real test is sending a message.

Lookbehind and catastrophic backtracking

Lookarounds test what surrounds a position without consuming it. Lookahead, (?=…) and (?!…), has always been part of JavaScript; lookbehind, (?<=…) and (?<!…), arrived in ES2018 and reached every major browser when Safari 16.4 shipped it in 2023. So (?<=\$)\d+ finds 42 in "$42" without including the dollar sign. Unlike many other engines, JavaScript allows lookbehind of any length.

The JavaScript engine is backtracking: when a path fails, it goes back and tries the alternatives. Nested quantifiers such as (a+)+$ give it an exponential number of ways to split the same text, so a string of 30 a's followed by an x can take seconds and a few more letters can take hours. This is catastrophic backtracking, and on servers it becomes ReDoS, a denial of service; a single WAF rule with this flaw took Cloudflare's network down for about half an hour on July 2, 2019. Because this tester runs in your tab, such a pattern can freeze the page; reload and rewrite it so that no two quantifiers can claim the same characters, using tighter classes like [^,]* instead of .*, or anchors. For editing the text itself rather than matching it, see the text tools; more developer utilities are in the developer tools hub.

Frequently asked questions

Why does my regex find only one match?
The g flag is off. Without it, the engine stops after the first match. Tick g to list every occurrence; the y flag alone also finds several, but only when they follow one another directly.
Does \d match digits from other scripts in JavaScript?
No. In JavaScript \d means only 0 to 9 and \w only ASCII letters, digits and underscore, even with the u flag. Use \p{Nd} or \p{L} with u for other scripts.
Will a pattern tested here behave the same in Python or PHP?
Basic syntax carries over, but details differ: Python's named groups are written (?P<name>…), PHP and Python support possessive quantifiers that JavaScript lacks, and lookbehind rules vary. Retest in the target engine.
How do I match a literal dot or bracket?
Escape it with a backslash: \. matches a period and \[ an opening bracket. Inside a character class most symbols are literal already, so [.] also matches only a dot.
Why did the page freeze while I was typing a pattern?
The pattern probably triggered catastrophic backtracking on your text. Reload, then avoid nested quantifiers such as (.*)* or (a+)+ and make each part match as little as it can.