ToolNest logoToolNest.

Free Online Regex Tester

Last updated: 2026-10-17

Quick answer: Debug your patterns in real time. Our free regex tester evaluates JavaScript regular expressions as you type — with live match highlighting, a full match list showing capture groups and positions, all five regex flags, and a find-and-replace mode. Your test data never leaves your browser.

🔒 100% Private: Data never leaves your device.
0 matches

    Find and Replace

    ✓ Free forever  ·  ✓ No signup  ·  ✓ Tool inputs stay in your browser — never sent to our servers.

    Try next: JSON Formatter · Slug Generator · Remove Duplicate Lines

    How to Use the Regex Tester

    1. Type your regular expression into the pattern box — results update live as you type.
    2. Toggle the flags: g for all matches, i for case-insensitive, m for ^$ per line, s for dot-matches-newline, u for Unicode.
    3. Paste your test text and watch matches highlight in yellow with a full match list below.
    4. Click a sample pattern (email, URL, phone…) to load a working example instantly.
    5. Use Find and Replace with $1, $2 backreferences to rewrite matched text.

    Why Use Our Regex Tester?

    Common Use Cases

    Regex Tester vs Alternatives

    If you need multi-flavor testing or a token-by-token pattern explainer, regex101.com is the deeper tool. For fast JavaScript-focused tests — live highlighting, capture-group match lists, and find-and-replace with backreferences, all private in your browser — this page is the quicker path.

    Frequently Asked Questions

    What is a regular expression?
    A pattern-matching language for text: \d+ finds runs of digits, [A-Z]+ finds uppercase words, ^https?:// matches URLs at a line start. This tester evaluates patterns with your browser's built-in JavaScript regex engine — the same engine Node.js and browsers use.
    Why does my pattern show as invalid?
    The tester passes your pattern straight to JavaScript's RegExp constructor, so any syntax the engine rejects — unbalanced parentheses, a stray backslash, an unescaped / — is flagged with the engine's exact error message. Fix the reported spot and it re-tests instantly.
    What do the g, i, m, s, and u flags do?
    g (global) finds all matches instead of stopping at the first; i makes matching case-insensitive; m makes ^ and $ match at line boundaries instead of just string ends; s lets . match newlines; u enables full Unicode handling (so emoji and astral characters match correctly).
    Why isn't my regex matching anything?
    The usual culprits: a missing g flag (only the first match is returned), unescaped special characters like . or ( in your data, case differences without the i flag, or ^/$ anchors when you meant to match mid-string. Toggle the flags and check the live highlight.
    Can I use lookbehind assertions?
    Yes — (?<=...) and (?
    Is my test data sent to a server?
    No. The pattern is compiled and run by your own browser's JavaScript engine. Test strings, however sensitive, never leave your device.
    How do I write a regex for email addresses?
    A practical pattern like ^[\w.+-]+@[\w-]+(\.[\w-]+)+$ catches virtually all real addresses and rejects the obvious junk. Don't chase a pattern that validates the full RFC spec — it exists, it's thousands of characters long, and it still can't tell you whether the address actually receives mail. For signup forms, validate the shape with regex, then verify with a confirmation email. Use the 'Email address' sample above to experiment.
    What is the difference between greedy and lazy matching?
    By default, quantifiers like .* are greedy: they grab as much text as possible. In '<b>one</b> and <b>two</b>', the pattern <b>.*</b> matches the whole string from the first tag to the last. Add a ? to make it lazy — <b>.*?</b> — and it stops at the first closing tag, matching each tag pair separately. Greedy-vs-lazy confusion is one of the most common reasons a pattern 'matches too much'.
    How do I match special characters like . ( ) [ ] literally?
    Escape them with a backslash: \. \( \) \[ \]. Inside a character class [...] most specials lose their meaning, so [().] matches a literal dot, paren, or dot without backslashes — but ] \ ^ and - still need care. To match a literal backslash itself, use \\ (four characters in the pattern for one backslash in the text, because the string escapes one level first).
    Why does my pattern behave differently in Python or PHP?
    This tester uses JavaScript's engine. The big differences: lookbehind assertions work here but fail on older browsers; \d in Python 3 matches Unicode digits by default while JavaScript's \d is ASCII-only unless you add the u flag; and named groups (?<name>...) exist in all three, but replacement syntax and flag letters differ. Always re-test a pattern in the language that will actually run it.
    What are capture groups, and how do I use them?
    Parentheses both group and capture: (\d{4})-(\d{2})-(\d{2}) applied to '2026-10-17' captures year, month, and day as groups 1–3. In the Find and Replace box, reference them as $1, $2, $3 — so replacing with $2/$3/$1 turns 2026-10-17 into 10/17/2026. The match list below the tester shows every group for every match, which makes it easy to check you captured what you intended.
    How do I make sure the ENTIRE string matches, not just part of it?
    Anchor both ends with ^ and $: ^\d+$ matches only strings that are all digits, while \d+ alone happily matches the '123' inside 'abc123xyz'. This is the classic form-validation bug — a pattern that 'works' in the tester but accepts garbage in production. For multiline text, the m flag makes ^ and $ match at each line boundary instead of just the string ends.