100% free
Regex tester
0 characters
Character classes
.Any character\dDigit [0-9]\wWord character [a-zA-Z0-9_]\sWhitespace[abc]a, b, or c[^abc]Not a, b, or c
Quantifiers
*0 or more+1 or more?0 or 1 (optional){n}Exactly n times{n,}n or more{n,m}n to m times
Anchors and groups
^Start of text (with flag m: start of line)$End of text (with flag m: end of line)\bWord boundary(abc)Group(?:abc)Non-capturing groupa|ba or b
How to test a regex in four steps
- Enter your pattern in the 'Regular expression' field, for example [a-z]+.
- Turn on the flags you need. 'g' is selected by default.
- Paste the text you want to search into the 'Test string' field.
- The matches appear highlighted, and the tool lists each one below.
If you'd rather not start from scratch, load an example. There are ready-made patterns for email addresses, URLs, US phone numbers, dates, IPv4 addresses, hex colors, HTML tags, and capitalized words.
How to read the match list
- A badge shows the number of matches or 'No matches'.
- The table gives each match a running number, its text, and its index. The index is the position in the test string and starts at 0.
- Capture groups appear as $1, $2, and so on. Named groups such as (?<year>\d{4}) show their name next to the number, for example $1 (year). A group that didn't take part in the match shows (not set).
- 'Copy' next to the pattern puts the pattern on your clipboard.
- A match with no characters appears as ∅ in the list.
- Without the 'g' flag, the tool returns only the first match.
What the regex tester can and can't do
The tester uses the regex engine of your browser, which means JavaScript. Patterns written for PHP, Python, or other languages only work if they fit JavaScript syntax.
The available flags are g, i, m, s, u, y, and, if your browser supports it, v. The flags u and v exclude each other, and the tool turns off whichever one you didn't just select. The tool doesn't offer the d flag (match indices).
The check runs in a Web Worker, separate from the page. If it takes longer than 750 milliseconds, the tester stops it and shows a message. The time counts only from the moment the worker is ready, so a slow start doesn't cause a stop. This typically happens with nested repetition such as (a+)+ on long text.
Common regex mistakes
- A dot stands for any character. To match a literal period, write \.
- A pattern like .* takes as much text as possible. With .*? you get the shortest match.
- The message about an invalid regular expression usually points to an unclosed bracket or a misplaced quantifier.
Frequently asked questions
What are regular expressions (regex)?
What are regex used for?
What do the regex flags mean?
What are common regex patterns?
How do I test my regex?
Can I also replace text with the regex tester?
Is the regex tester free, and is my text sent anywhere?
Related tools
Changelog
November 20, 2026
Named groups, fair time limit, and corrected anchors
- • Added: named groups show their name next to the number in the match list, for example $1 (year)
- • Fixed: the 750 millisecond time limit started when the worker started. On slow devices, a harmless pattern could trigger a timeout. The time now counts from the start of the evaluation
- • Corrected: the cheat sheet listed ^ and $ as start and end of line. Without the m flag, they stand for start and end of text
- • The FAQ now says the tester has no replace test
November 18, 2026
Flags u, v, and y
- • Added the flags u (unicode), y (sticky), and, if the browser supports it, v (unicodeSets)
- • u and v exclude each other: turning one on turns the other off
- • With u or v, empty matches skip a whole character outside the basic alphabet, such as an emoji
November 17, 2026
Guide and related tools
- • Added a guide with instructions and use cases below the tool
- • Added related tools at the end of the page
Show older versions
December 8, 2025
Launch
- • Live regex testing
- • Highlighting of matches
- • Support for the flags g, i, m, and s
- • Display of capture groups
- • Ready-made regex examples
- • Error handling for invalid patterns