Skip to main content
SlapMyWeb
Skip to tool
Free tool

Regex tester

Test regular expressions with inline highlighting, capture groups, replace mode, and a built-in cheat sheet. All JavaScript regex flags supported.

//g
The Quick Brown Fox Jumps Over The Lazy Dog
9 matches0.14ms8 unique
matches
#1
Theindex 03
#2
Quickindex 49
#3
Brownindex 1015
#4
Foxindex 1619
#5
Jumpsindex 2025
#6
Overindex 2630
#7
Theindex 3134
#8
Lazyindex 3539
#9
Dogindex 4043

What is Regex Tester?

A regex tester is an essential developer tool for writing, testing, and debugging regular expressions in real time. Regular expressions (regex) are powerful pattern-matching sequences used in programming for text search, validation, extraction, and replacement. Our free online regex tester provides instant feedback as you type your pattern and test string, showing all matches with inline highlighting directly in your text. It supports all JavaScript regex flags including global (g), case-insensitive (i), multiline (m), and dotall (s). The built-in replace mode lets you test substitutions with group references ($1, $2), and the cheat sheet sidebar gives you quick access to common patterns. Whether you are validating email addresses, parsing log files, extracting data from HTML, or building input validation for web forms, this tool helps you iterate on your regex patterns without writing throwaway code.

How to Use Regex Tester

  1. 1

    Enter your regex pattern

    Type your regular expression in the pattern field. Select the flags you need — global for all matches, case-insensitive for ignoring case, multiline for line-by-line matching, or dotall to match newlines with the dot character.

  2. 2

    Paste your test string

    Enter or paste the text you want to test against. Matches are highlighted inline with colored underlines directly in your test string, making it easy to see exactly what your pattern captures.

  3. 3

    Use replace mode

    Toggle Replace to enter a substitution string. Use $1, $2 for captured groups. The replaced result appears below in real time.

  4. 4

    Reference the cheat sheet

    Toggle the Cheat Sheet for a quick reference of common regex syntax. Click any pattern to insert it directly into your regex.

Features

  • Inline match highlighting with colored spans in test string
  • Match statistics: count, unique matches, execution time
  • Replace/substitution mode with group references ($1, $2)
  • Built-in regex cheat sheet with clickable patterns
  • Full capture group extraction with numbered group display
  • Support for all JavaScript flags: global, case-insensitive, multiline, dotall
  • Match index range positions for precise location identification
  • One-click copy of all matched values

Related Tools

Frequently Asked Questions

Which regex flavor does this tester use?+
This tool uses the JavaScript RegExp engine built into your browser. It supports all ECMAScript regex features including lookahead (?=), lookbehind (?<=), named groups (?<name>), and Unicode property escapes (\p{}).
What do the different flags (g, i, m, s) do?+
The g (global) flag finds all matches instead of stopping at the first one. The i flag makes matching case-insensitive. The m (multiline) flag makes ^ and $ match line boundaries instead of string boundaries. The s (dotall) flag makes the dot (.) match newline characters as well.
How does replace mode work?+
Toggle the Replace button to enter a replacement string. Use $1, $2 etc. to reference captured groups from your pattern. The tool shows the result of calling JavaScript's String.replace() with your regex and replacement string in real time.
What do the match colors mean?+
Each match gets a unique color from a rotating palette to help you visually distinguish adjacent or overlapping matches in the highlighted preview. The colors cycle through blue, purple, orange, green, pink, and yellow.
Why does my regex cause an infinite loop?+
Zero-length matches (like the pattern .*) can cause infinite loops with the global flag because the regex engine matches at the same position repeatedly. This tool automatically advances past zero-length matches to prevent browser freezing.
Is my test data sent to any server?+
No. All regex matching happens entirely in your browser using the native JavaScript RegExp engine. Your patterns and test strings never leave your device, making this tool safe for testing patterns against sensitive data.