Regex Tester
Last updated:
Write a regular expression and test it against your text in real time. See highlighted matches, capture groups, and replace output, with every flag at your fingertips, all running privately in your browser.
JavaScript regex engine. Runs entirely in your browser.
Fixing this for a client? There’s a commission in it for you.
When a client needs work you don’t do (a website, SEO, GEO, or maintenance), send them our way. You earn 10% or $100, whichever is greater.
Use our tools for client work? Let’s make it pay.
Refer clients who need a website, SEO, or AI-search visibility to Web Aloha and earn 10% or $100, whichever is greater. Retainers pay 10% monthly for 6 months.
Want us to act on this result? Fix these findings →
Prefer the partnership route? Refer clients to us, earn 10% →
Refer a Client, Earn 10% or $100
Use our tools for client work? When a client needs a website, SEO, or AI-search visibility, send them our way and earn 10% or $100, whichever is greater.
How to Use the Regex Tester
- Enter a pattern, type your regular expression between the slashes.
- Set flags, toggle global, case-insensitive, multiline, and more.
- Add test text, matches highlight live as you type.
- Inspect groups and replace, review capture groups and preview replacements.
Regex Quick Reference
\ddigit,\wword char,\swhitespace,.any char.*zero or more,+one or more,?optional,{n,m}range.^start,$end,\bword boundary.(...)capture group,(?<name>...)named group,(?:...)non-capturing.[abc]character set,[^abc]negated set,a|balternation.
Regex Cheat Sheet
A reference for the regular expression tokens you will use most often. Examples use JavaScript (ECMAScript) syntax, the same engine this tester runs. Paste any example into the pattern field above to see it match.
Character classes
| Token | Matches | Example |
|---|---|---|
. | Any character except a line break (any character including newlines with the s flag) | a.c matches "abc", "a c" |
\d | Any digit, 0 to 9 | \d\d matches "42" |
\D | Any non-digit character | \D matches "a", "-" |
\w | Any word character: letters, digits, or underscore ([A-Za-z0-9_]) | \w+ matches "user_1" |
\W | Any non-word character | \W matches "!", " " |
\s | Any whitespace: space, tab, newline | \s matches " ", a tab |
\S | Any non-whitespace character | \S+ matches "word" |
[abc] | Any one of the listed characters; ranges allowed with - | [a-f] matches "c" |
[^abc] | Any single character not listed (negated class) | [^0-9] matches "x" |
\. | A literal dot; backslash escapes any special character | \. matches "." only |
Anchors and boundaries
| Token | Matches | Example |
|---|---|---|
^ | Start of the string (or start of each line with the m flag) | ^Hi matches "Hi there" |
$ | End of the string (or end of each line with the m flag) | end$ matches "the end" |
\b | A word boundary (position between \w and non-\w) | \bcat\b matches "cat" not "category" |
\B | A non-word-boundary position | \Bcat matches "cat" in "scatter" |
Quantifiers
| Token | Matches | Example |
|---|---|---|
* | Zero or more of the preceding token (greedy) | ab* matches "a", "abbb" |
+ | One or more of the preceding token (greedy) | \d+ matches "2026" |
? | Zero or one of the preceding token (optional) | colou?r matches "color", "colour" |
{n} | Exactly n of the preceding token | \d{4} matches "2026" |
{n,m} | Between n and m of the preceding token; {n,} means n or more | \d{2,4} matches "12" to "1234" |
*? +? | Lazy versions: match as few as possible | <.*?> matches one tag, not all |
Groups and alternation
| Token | Matches | Example |
|---|---|---|
(...) | Capturing group; stores the match as $1, $2, and so on | (\d{4})-(\d{2}) captures year and month |
(?:...) | Non-capturing group; groups without storing a reference | (?:ab)+ matches "abab" |
(?<name>...) | Named capturing group, referenced by name | (?<y>\d{4}) captures as "y" |
| | Alternation: match the expression before or after it | cat|dog matches "cat" or "dog" |
Flags
| Flag | Effect |
|---|---|
g | Global: find all matches, not just the first |
i | Case-insensitive matching |
m | Multiline: ^ and $ match line starts and ends |
s | Dotall: . also matches newline characters |
u | Unicode: treat the pattern as Unicode code points |
y | Sticky: match only at the current lastIndex position |
Regular expressions power validation, search, and data cleanup across almost every codebase. If you would rather offload tricky parsing, scraping, or data-transformation work, our team builds and maintains it as part of our web design and development services.
Next steps
Regex Tester related tools and articles
Continue with the closest follow-up checks and guides based on this tool's topic, crawl intent, and optimization workflow.
Regex Tester: FAQ
Which regular-expression engine does this tester use?
How do the g, i, m, s, and u controls affect the preview?
Why are capture groups shown only once?
How does the replacement preview handle group references?
Why does the tool say preview skipped?
What does an invalid result mean?
How are empty-string matches handled?
Are my pattern, sample text, and replacement uploaded?
Need Custom Tools or Automation?
From data cleanup to bespoke web apps, we build fast, reliable tooling that saves your team hours.