Free Online Tool

Regex Tester, Test Regular Expressions Online

Write a pattern, paste your text, and watch matches highlight live in this free online regex tester. Use it as a regex checker, a regex debugger, a regex editor, and a quick regular expression test online: capture groups, all six flags, a built-in pattern library, and a full cheat sheet on the same page. This online regex tool runs entirely in your browser, so there is no signup, nothing uploaded, and it works on your phone.

★★★★★4.8, used by developers, QA engineers, and data folks
g
Flags
Match preview
Reach us at hello@gizmoop.com or press@gizmoop.com. Not an email: not-an-email Another one: support@example.org
3 matchesFlags active: g
#1 at position 12hello@gizmoop.com
#2 at position 33press@gizmoop.com
#3 at position 92support@example.org
Common patterns library

Why use this regex tester

Built for fast iteration, not for ceremony.

Live match preview

Matches highlight as you type. No "run" button, no waiting.

All six flags

Toggle g, i, m, s, u, and y with hover tooltips that explain each one.

Common patterns library

Click to load email, URL, phone, IP, hex color, and other tested patterns.

Mobile friendly

Works on phones and tablets. Test patterns from anywhere, not just at your desk.

100% private

Your pattern and test string never leave your browser. Nothing is logged.

No signup

No account, no email, no rate limit. Open the page and you're testing in two seconds.

What people test regex for

A pattern saves an afternoon when it works, and costs you a week when it doesn't. Verify it here first.

Form validation

Check email, phone, postcode, and password rules before they hit your backend.

Log parsing

Pull timestamps, IP addresses, and error codes out of server logs and traces.

Search and replace

Build the pattern here, then drop it into your editor or shell script with confidence.

Data extraction

Scrape phone numbers, prices, or SKUs from messy strings without writing a parser.

URL routing

Test the regex behind your router or rewrite rule before pushing to production.

Password rules

Verify "at least one uppercase, one digit, eight characters" without spinning up a test runner.

Regex cheat sheet

Every token you'll reach for, grouped by purpose. Bookmark this page and stop searching Stack Overflow for the same answers.

Character classes

TokenWhat it does
\dAny digit, equivalent to [0-9].
\DAnything that is not a digit.
\wWord character: letters, digits, or underscore.
\WAnything that is not a word character.
\sAny whitespace: space, tab, newline, etc.
\SAnything that is not whitespace.
.Any single character except newline (unless the s flag is set).
[abc]Character class. Matches a, b, or c.
[^abc]Negated class. Matches any character that is not a, b, or c.
[a-z]Range. Matches any lowercase letter.

Anchors and boundaries

TokenWhat it does
^Start of the string (or start of each line with the m flag).
$End of the string (or end of each line with the m flag).
\bWord boundary. Position between a word character and a non-word character.
\BNot a word boundary.
\AStart of input. Not supported in JavaScript, use ^ instead.
\ZEnd of input. Not supported in JavaScript, use $ instead.

Quantifiers

TokenWhat it does
*Zero or more of the preceding token. Greedy.
+One or more of the preceding token. Greedy.
?Zero or one. Makes the preceding token optional.
{n}Exactly n occurrences.
{n,}At least n occurrences.
{n,m}Between n and m occurrences.
*?Lazy version of *. Matches as few as possible.
+?Lazy version of +.
??Lazy version of ?.
{n,m}?Lazy bounded repetition.

Groups and lookarounds

TokenWhat it does
(abc)Capturing group. Saves the match for later as $1, $2, etc.
(?:abc)Non-capturing group. Groups without consuming a slot.
(?<name>abc)Named capturing group. Reference as $<name>.
(?=abc)Positive lookahead. Match only if followed by abc.
(?!abc)Negative lookahead. Match only if not followed by abc.
(?<=abc)Positive lookbehind. Match only if preceded by abc.
(?<!abc)Negative lookbehind. Match only if not preceded by abc.
\1Backreference to the first capture group.

Alternation

TokenWhat it does
a|bAlternation. Matches a or b.
(cat|dog)Grouped alternation. Useful inside larger patterns.

Escape characters

TokenWhat it does
\\A literal backslash.
\.A literal dot. Without the escape, dot matches any character.
\(A literal opening parenthesis.
\[A literal opening square bracket.
\nA newline character.
\tA tab character.
\rA carriage return.
\uXXXXA Unicode code point in the BMP.

Flags

TokenWhat it does
gGlobal. Find every match, not just the first one.
iCase insensitive. "Foo" matches "foo" and "FOO".
mMultiline. ^ and $ match the start and end of each line.
sDotall. Lets dot (.) match newline characters.
uUnicode. Treats the pattern as a sequence of code points.
ySticky. Matches only from the lastIndex position.

Everything you need to know about regex

The parts of the docs that actually matter, written for the people who skip the docs.

What is a regular expression?

A regular expression is a small language for describing patterns in text. Instead of asking "does this string contain the word cat," you can ask "does this string contain three digits followed by a dash followed by four digits," and you can do it in seven characters. Regex is built into almost every programming language, every text editor worth using, and most command line tools like grep, sed, and ripgrep. Once you've learned the basics, you stop writing loops for problems that should be one line.

The trade-off is readability. A regex that took you ten minutes to write can take a teammate ten minutes to read. That's why testing patterns on real input matters. If you can't see the pattern matching what you expect, you can't trust it in production. Use this regex tester to build the regular expression, then add a comment in your code explaining what it matches. Your future self will thank you.

How to use this online regex tester

Testing a pattern here takes four steps. First, type your regular expression into the pattern box at the top. Second, toggle the flags you need, most people reach for g and i, and the tooltips explain the rest. Third, paste the string you want to check into the test text area. Fourth, read the highlighted output and the capture groups panel. Because the tester runs live, every keystroke updates the matches, so you can adjust the pattern character by character until it does exactly what you intend.

That live loop is what makes an online regex tool faster than writing a throwaway script. You do not compile anything, you do not switch windows, and you do not lose your place. When the pattern is wrong, the tester shows the exact JavaScript syntax error instead of failing silently. When the pattern is right, the highlighting and group breakdown confirm it on real input. Treat this page as a regex checker you keep open in a tab while you work.

Why use a regex tester online instead of an IDE

A regex tester online has one big advantage over your code editor: it isolates the pattern from the rest of your program. When a regular expression misbehaves inside an app, you cannot always tell whether the bug is in the pattern, the surrounding code, or the input data. A dedicated regex online environment removes those variables. You see the raw pattern, the raw text, and the raw matches, with nothing else in the way. That clean separation turns a frustrating debugging session into a five-second check.

It is also faster to share. Because this is a regular expression test online, you can describe a pattern to a teammate and they can reproduce it instantly without cloning a repo or installing anything. A regex pattern tester that lives at a URL becomes a common reference point for code reviews, bug reports, and tutorials. The pattern, the flags, and the sample text are all visible at once, so there is no ambiguity about what you tested.

Regex tester vs regex generator: which do you need?

A regex tester and a regex generator solve two different halves of the same job. A tester takes a pattern you already have and shows you what it matches, so it is the right tool when you are debugging, learning, or verifying a regular expression before it ships. A regex generator works the other way: you describe the text you want to match in plain English or with examples, and it proposes a pattern for you. Both are useful, and the workflow that wins is to draft a pattern, then bring it here to confirm it on the inputs that actually matter.

If you are new to regex, start by reading the cheat sheet above and copying a pattern from the common patterns library, then tweak it in the tester until it fits your data. That hands-on loop teaches the syntax faster than any generator, because you see cause and effect immediately. Once you can read a pattern fluently, a generator becomes a time saver rather than a crutch.

Is a regex tester the same as a regex calculator?

People search for a regex calculator when they want to know the answer to one specific question: given this pattern and this input, what does it match? That is exactly what this regex tester does. It does not solve math, it evaluates a regular expression against text and shows you the result, the same way a calculator evaluates an expression and shows you a number. If a regex calculator is the tool you had in mind, you are already on the right page.

The advantage of thinking of it that way is that it sets the right expectation. A calculator gives a deterministic answer, and so does a regex engine: the same pattern, flags, and input always produce the same matches. When the result surprises you, the pattern or the flags are wrong, not the engine. Change one token, watch the output update, and repeat until the answer is the one you wanted.

Common regex patterns explained

Email validation is the classic example. A reasonable pattern is ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$. It says: start of string, one or more allowed local-part characters, an @ sign, one or more allowed domain characters, a literal dot, and at least two letters for the TLD. It rejects "missing@dot" and "spaces in@local.com" while accepting the addresses you actually want. It is not RFC 5322 compliant, no useful email regex is, but it is good enough for form validation.

URLs are similar. ^https?:\/\/[^\s]+$ matches "https://example.com" and any URL without whitespace. Phone numbers in the US look like ^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$ which accepts "(415) 555-0199", "415.555.0199", and "+1 415 555 0199". IPv4 addresses use ^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$ as a quick check, though it won't reject "999.999.999.999", so combine it with a numeric range check in code.

Dates and times are common too. An ISO date like 2026-05-16 matches ^\d{4}-\d{2}-\d{2}$, and you can add capture groups to pull the year, month, and day apart. A hex color matches ^#?[0-9a-fA-F]{3,8}$, a US ZIP code matches ^\d{5}(?:-\d{4})?$, and a strong password rule that requires a digit, a lowercase letter, an uppercase letter, and eight characters uses lookaheads: ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}$. Load any of these into the tester from the patterns library and adjust them to your data.

Using this page as a Java regex tester

A Java regex tester needs one extra mental step compared to JavaScript. In Java, your pattern lives inside a string literal, so every backslash has to be doubled. A pattern that reads \d{3} in this tester becomes "\\d{3}" in your Java source. The fix is simple: build and verify the pattern in its bare form here, where you can see it match cleanly, then double each backslash when you paste it into Pattern.compile(). The core syntax behind character classes, quantifiers, anchors, and groups behaves the same way, so the match results you see on this page carry over.

Java's java.util.regex engine adds a few features JavaScript does not have, mainly possessive quantifiers like a++ and atomic groups with (?>...). If your pattern uses those, build the rest of it here, confirm the match, and add the Java-only pieces last. For the vast majority of validation and extraction patterns, this online regex tester is an accurate Java regex test, and the only difference you will hit is the backslash escaping.

Running a Python regex test

For a Python regex test, this tool covers most of what the re module does. Character classes, quantifiers, anchors, alternation, and capturing groups all behave the same, so a pattern you verify here will usually work unchanged in re.match(), re.search(), andre.findall(). The main thing to watch is named groups: Python accepts both the modern(?<name>...) syntax and the older (?P<name>...) form, while this JavaScript engine uses only the first. Build the pattern here, then switch syntaxes if your Python code expects the ?P style.

Python also makes raw strings the norm for regex, written as r"\d+", which spares you the doubled backslashes Java requires. That means the pattern you copy out of this regex editor drops almost directly into Python. Verify the flags too: Python uses re.IGNORECASE andre.MULTILINE instead of the i and m letters, but they map one to one with the flag toggles on this page.

Regex flavor differences (JavaScript vs PCRE vs Python vs Java)

All four flavors share the same core syntax: character classes, quantifiers, anchors, and groups. Where they diverge is on advanced features. JavaScript (the engine behind this tester) supports lookbehind as of ES2018 and named groups with (?<name>...). It does not support possessive quantifiers, recursive patterns, or conditional patterns. PCRE, used by PHP and many command line tools, supports all three plus atomic groups with (?>...). Python's re module sits in the middle: it supports lookbehind (fixed-width only) and named groups, but uses (?P<name>...) as the older syntax. Java's java.util.regex package is close to PCRE and supports possessive quantifiers and atomic groups, but requires you to double-escape backslashes inside Java string literals.

Practical advice: write the simplest pattern that works, and test it in the engine you'll actually run it in. A regex that works in PCRE may throw a syntax error in JavaScript. This page is a JavaScript regex test online, so most of your pattern body will transfer to Java and Python unchanged, but verify the advanced pieces. If you need cross-language portability, stick to character classes, quantifiers, anchors, basic groups, and alternation, and skip advanced features unless one specific engine is your home base.

How to debug a regex that almost works

When a regular expression matches too much, too little, or the wrong thing, debug it from the inside out. Start by deleting the pattern down to the smallest piece that should match, confirm that piece works in the tester, then add the next token and check again. Most bugs come from three places: an unescaped dot or other metacharacter, a greedy quantifier that swallows more than you expected, and a missing anchor that lets the pattern match in the middle of a string instead of the whole thing.

Use the capture groups panel as your magnifying glass. If a group is empty or contains the wrong text, you have isolated the failing section without guessing. Switch a greedy * or + to its lazy form (*? or +?) when the match runs too far, and add^ and $ when you mean the entire string. Toggling the g flag also helps: it lets you see every place the pattern matches, which often reveals an unexpected second match you did not know was there.

When NOT to use regex

Regex is the wrong tool for parsing structured formats like HTML, JSON, XML, and source code. These formats have nested structure that regex can't represent without becoming unreadable. Use a real parser: DOMParser for HTML, JSON.parse for JSON, an XML library for XML, and an AST tool like Babel or tree-sitter for code. The classic "you can't parse HTML with regex" Stack Overflow answer exists because the lesson keeps needing to be relearned.

Regex is also the wrong tool when you need fuzzy matching, semantic matching, or anything that depends on meaning rather than shape. "Find every misspelling of receive" is not a regex problem, it's a Levenshtein distance problem. "Find every paragraph about pricing" is not a regex problem, it's a search problem. Use regex for shape, use specialized tools for meaning.

Regex performance and ReDoS

Most regex runs in linear time, but a few patterns can blow up. The classic case is nested quantifiers like (a+)+$ applied to a string of as followed by anything else. The engine tries every possible split of the as between the inner and outer quantifier before giving up, which takes exponential time. This is called ReDoS, or regular expression denial of service. If an attacker can send you a string and your regex backtracks, they can hang your server.

Avoid it by writing patterns that don't allow ambiguous matches. Use character classes instead of alternation when the alternatives overlap. Anchor your patterns with ^ and $ when you mean the whole string. Avoid putting a quantifier inside another quantifier. If you have to use nested quantifiers, test against an adversarial input of repeating characters and check that the regex returns in under a millisecond. If it doesn't, rewrite the pattern.

Is this online regex tool private and free?

Yes on both counts. This regex tester runs entirely in your browser, so your pattern and your test text are never uploaded, logged, or sent to a server. That matters when you are testing regular expressions against production data, API keys, customer records, or anything else you would not paste into a random website. The tool is free with no account, no email, and no usage limit, and it stays usable offline once the page has loaded.

Because nothing leaves your device, the tester is also fast: there is no network round trip between keystrokes, so matches update instantly even on a slow connection. Bookmark the page, install Gizmoop as a PWA, or keep the tab open as your everyday regex checker and debugger.

Frequently asked questions

If you don't find your question here, ask us directly.

A regex tester is a tool that lets you write a regular expression and check it against sample text in real time. You see which substrings match, what the capture groups contain, and whether your pattern has a syntax error. It saves you from writing a script just to verify a pattern, and it is the fastest way to learn how regex actually behaves.

Type your pattern into the input box, pick the flags you need (most people want g and i), and paste your sample text below. Matches are highlighted as you type. If the pattern is invalid, you'll see the exact JavaScript error so you can fix it. Nothing is uploaded, the regex engine runs locally in your browser.

The g flag stands for global. Without it, a regex stops at the first match. With it, the engine keeps scanning the whole string and returns every match. Use g whenever you want to find all email addresses, all numbers, or replace every occurrence. Without g, methods like matchAll throw an error in JavaScript.

A practical pattern is ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$. It covers the vast majority of real addresses but it isn't RFC 5322 perfect (no regex truly is). For most form validation, this pattern plus a confirmation email is the right balance. Don't try to write a perfect email regex, it isn't worth the complexity.

Both are quantifiers. The star (*) means "zero or more of the preceding token." The plus (+) means "one or more." So a* matches "" or "aaa", while a+ requires at least one a and would not match an empty string. If you want at least one character, use +. If a missing token is acceptable, use *.

Wrap part of your pattern in parentheses to capture it. The pattern (\d{4})-(\d{2})-(\d{2}) captures year, month, and day from a date like 2026-05-14. In replacement strings you reference them as $1, $2, $3. For named groups, use (?<year>\d{4}) and reference them with $<year>. Non-capturing groups use (?:...) when you only need grouping.

Lookarounds let you assert what comes before or after a position without including it in the match. Positive lookahead (?=...) asserts what follows. Negative lookahead (?!...) asserts what does not follow. Lookbehind (?<=...) and (?<!...) do the same backwards. They are useful for "match a number not preceded by a dollar sign" or password rules like "must contain a digit."

Some patterns trigger catastrophic backtracking. Nested quantifiers like (a+)+ on a long string of as can take seconds or hang the page. This is called ReDoS (regular expression denial of service). Avoid nested quantifiers, use possessive groups when available, and anchor your patterns. If a tester hangs, your pattern is the cause, not the engine.

This tool uses your browser's JavaScript regex engine (V8 in Chrome, SpiderMonkey in Firefox). Most syntax is portable, but a few features differ. JavaScript supports lookbehind but not recursive patterns. PCRE supports atomic groups and conditional patterns that JavaScript doesn't. Python's re module uses similar syntax but treats unicode and escapes slightly differently. Test in the engine you'll actually deploy.

Yes, once the page loads. The regex engine, the pattern library, and the cheat sheet all run in your browser. There's no server roundtrip per keystroke and no analytics on your pattern. You can save the page or install Gizmoop as a PWA and keep testing patterns on a plane.

It is a fully online regex tester, so there is nothing to download or install. You open the page in any modern browser and start testing regular expressions immediately. Because the regex engine runs locally, it behaves like a desktop app: instant matches and no network delay. If you want it to feel native, install Gizmoop as a PWA from your browser menu.

A regex tester takes a pattern you already have and shows you exactly what it matches, which is what you need for debugging and verifying. A regex generator goes the other direction: you describe the text you want to match and it proposes a pattern. The two complement each other, and the safest workflow is to draft a pattern however you like, then confirm it in a tester against real input before you ship it.

Yes. The live highlighting and capture groups panel make it a practical regex debugger for patterns that almost work. Trim the pattern down to its smallest matching piece, confirm it, then add tokens back one at a time until the bug appears. Watching the matches and groups update on each keystroke usually pinpoints the failing section faster than reading the pattern by eye.

This tool uses the browser JavaScript regex engine, so it is most accurate for JavaScript regular expressions. The core syntax, including character classes, quantifiers, anchors, groups, and alternation, is shared with Java and Python, so most patterns transfer unchanged. The advanced pieces differ: Java supports possessive quantifiers and Python uses a slightly different named-group syntax, so verify those features in your target engine before deploying.

All six JavaScript flags are available: g for global matching, i for case insensitive matching, m for multiline anchors, s for dotall so the dot matches newlines, u for full Unicode handling, and y for sticky matching from a fixed position. Each flag has a hover tooltip that explains what it does. Toggle them on and off to see how the same pattern behaves differently.

Turn on the g (global) flag. Without it, a regex stops at the first match, so a search-and-replace would only touch one spot. With g enabled, the tester highlights every match in your test text and the engine returns all of them. This is the flag you want for extracting every email, every number, or every URL from a block of text.

Yes. Like regexr, this online regex tester gives you live match highlighting, a flag panel, capture group display, and a reference cheat sheet, all in one page. It runs entirely in your browser with no account and no signup. If you came here searching for regexr, you can test and debug regular expressions here the same way.

Yes. A regex calculator simply evaluates a pattern against input text and shows you what matches, and that is exactly what this tool does. Type your regular expression, paste the text, and read the result. The output is deterministic: the same pattern, flags, and input always produce the same matches.

It does. The pattern box, live highlighting, and capture groups panel together act as a focused regex editor where you build, refine, and verify a pattern before moving it into your code. Every keystroke updates the matches, so you can shape the regular expression token by token. When it is correct, copy it straight into your project.

Just open this page. It is a fully online regex tool, so there is nothing to download, no extension to add, and no setup. The regex engine runs locally in your browser, which keeps it fast and private, and the page works on desktop, tablet, and phone. Bookmark it and you have a regex online environment ready whenever you need it.

Use the tester as a regex pattern tester by working from the inside out. Trim the regular expression to the smallest piece that should match and confirm it, then add one token at a time and check the highlighting after each change. The capture groups panel pinpoints which section is failing, and switching greedy quantifiers to lazy ones often fixes a match that runs too far.

Try our other free tools

JSON formatter, base64 encoder, URL encoder, and 47 more.