Ctrl + K
Developer

Regex Tester

Test, debug, and explain regular expressions with real-time matching, group capturing, and replacement.

Regular Expression
/ /
Test String 0 chars
Matches

Enter a pattern and test string to see results

JWT Decoder & Parser

Decode and inspect JSON Web Token payloads →

All regex testing happens locally in your browser. Your test strings and patterns are never sent to any server, cached, or stored. Full support for all standard JavaScript regex features including lookaheads, backreferences, and named groups.

A regular expression (regex) is a sequence of characters that defines a search pattern, used for string matching, validation, extraction, and replacement. Our free Regex Tester lets you build, test, and debug regular expressions in real-time with instant match highlighting and detailed group information. All processing is done client-side with zero data uploads.

What Is a Regular Expression?

A regular expression (regex or regexp) is a formal grammar for matching patterns in text. Originating from mathematical automata theory, regular expressions are now a standard feature in nearly every programming language and text editor. A regex pattern describes a set of strings using metacharacters (.*+?[](){}^$|) combined with literal characters. Modern regex engines support advanced constructs like lookahead/lookbehind assertions, named capture groups, backreferences, and atomic groups.

How to Use the Regex Tester

  1. Enter your pattern — Type your regular expression into the pattern input between the / delimiters.
  2. Set flags — Toggle regex flags like g (global), i (case-insensitive), and m (multiline) by clicking the flag buttons.
  3. Provide test text — Paste or type the string you want to test against in the test string textarea.
  4. View matches instantly — Matches are highlighted in real-time within the test string and detailed in the results panel below.
  5. Switch to Replace mode — Enter a replacement string with $1, $&, etc. to test find-and-replace operations.

Key Features

  • Real-Time Highlighting

    Matches are highlighted instantly within the test string as you type.

  • Capture Group Details

    View each match with its index and all captured groups displayed clearly.

  • Match & Replace Modes

    Toggle between pure matching and find-and-replace with capture group references.

  • All Standard Flags

    Support for g, i, m, s, u, and y flags — clickable toggle buttons.

  • Error Feedback

    Clear error messages for invalid regex patterns or syntax errors.

  • 100% Private

    All processing runs client-side. Nothing leaves your browser.

Common Use Cases

  • Input Validation: Test patterns for email addresses, phone numbers, URLs, credit card numbers, and other structured data.
  • Log Parsing: Extract structured data from server logs, CSV files, or any text with consistent formatting.
  • Code Search & Refactoring: Find code patterns across large codebases and perform targeted search-and-replace operations.
  • Data Scraping: Extract specific content from HTML, JSON, or plain text documents using carefully crafted patterns.

Frequently Asked Questions

What regex engine does this tool use?
This tool uses JavaScript's built-in RegExp engine (ECMAScript specification). It supports all standard features including lookaheads ((?=), (?!)), lookbehinds ((?<=), (?<!)), named capture groups ((?<name>...)), and Unicode property escapes (\p{}) with the u flag.
What do the regex flags do?
  • g (global) — Find all matches, not just the first.
  • i (case-insensitive) — Ignore case when matching.
  • m (multiline) — ^ and $ match line boundaries.
  • s (dotAll) — . matches newline characters.
  • u (unicode) — Enable Unicode property escapes and correct Unicode handling.
  • y (sticky) — Match only from the last index position.
How do I use capture groups in replacement?
In Replace mode, you can reference captured groups in the replacement string: $1, $2, etc. for numerical groups, $& for the full match, $` for text before the match, and $' for text after. Named groups are referenced as $<name>.
Why is my regex not matching anything?
Common issues include missing the g flag for multiple matches, incorrect escaping of special characters, or pattern anchors (^ / $) that don't align with your input. Use the error feedback to spot syntax problems and check that your flags are set appropriately for your use case.

Related Tools