/ /g \d+ [a-z] ( ) .*? \w+ ^$

Regex Tester

Test and debug regular expressions in real-time. Live match highlighting, group capture, find & replace, common patterns library. Free, instant, 100% browser-based.

Real-time
How it works: Type a regex pattern below, paste your test text on the left, and see matches highlighted instantly on the right. Click Patterns for ready-made presets, or toggle flags like g i m to change matching behavior.
/ /

Test String

Matches

Enter a regex pattern and test string to see highlighted matches
Enter a regex pattern above to start testing
Matches 0
Groups 0
Flags g
Time 0 ms

What is a Regular Expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. Regex is used in programming, text editors, and command-line tools to find, match, and manipulate text. It is one of the most powerful tools for string processing.

This tool uses JavaScript's built-in RegExp engine, which follows the ECMAScript specification. Results will match what you get in JavaScript, Node.js, and most modern browsers.

Regex Flags Explained

FlagNameWhat it Does
gGlobalFind all matches, not just the first one
iCase-insensitiveMatch uppercase and lowercase letters equally (A matches a)
mMultiline^ and $ match start/end of each line, not just the string
sDotAllMakes . match newline characters too (normally it doesn't)
uUnicodeEnable full Unicode matching (emoji, accented characters, etc.)
yStickyMatch only at the exact position of lastIndex
Advertisement
Ad

How to Use — 3 Simple Steps

01

Enter Your Pattern

Type your regex pattern in the input bar at the top. Toggle flags (g, i, m, etc.) by clicking them. Or choose a preset from the Patterns dropdown.

02

Add Your Test String

Paste or type the text you want to search in the left panel. Matches are highlighted instantly on the right as you type.

03

Explore Results

Switch to Details tab to see each match's index, length, and captured groups. Use Replace mode for find & replace with $1, $2 substitutions.

Common Regex Patterns

PatternDescriptionExample Match
\d+One or more digits42, 2024
\w+Word characters (letters, digits, underscore)hello, user_123
[a-z]+Lowercase lettersabc, hello
^.+$Entire line (with m flag)Any complete line
\b\w+@\w+\.\w+\bSimple emailuser@example.com
(\d{2})/(\d{2})/(\d{4})Date DD/MM/YYYY with groups25/12/2024
(?<=@)\w+Lookbehind — word after @gmail (from user@gmail)

Pro Tips

Use Non-Greedy Matching

Add ? after quantifiers (*?, +?, {n,m}?) to match as few characters as possible instead of as many.

Named Capture Groups

Use (?<name>...) to name your groups. In replace mode, reference them with $<name> for clearer substitutions.

Lookahead & Lookbehind

(?=...) lookahead and (?<=...) lookbehind match positions without consuming characters. Great for validating context.

Escape Special Characters

Characters like . * + ? ^ $ { } [ ] ( ) | \ have special meaning. Prefix with \ to match them literally.

Advertisement
Ad

Frequently Asked Questions

What regex flavor does this tool use?

This tool uses JavaScript's built-in RegExp engine, which follows the ECMAScript specification. It supports all standard flags including g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), and y (sticky).

What are capture groups in regex?

Capture groups are created with parentheses () in a regex pattern. They let you extract specific parts of a match. For example, in the pattern (\d{4})-(\d{2})-(\d{2}), each set of parentheses captures a group: year, month, and day from a date string like 2024-01-15.

What does the g flag do?

The g (global) flag makes the regex find ALL matches in the string, not just the first one. Without g, the regex stops after the first match. With g, it continues searching through the entire string.

How does Find & Replace work?

In Replace mode, you can use $1, $2, etc. to reference captured groups in your replacement string. For example, matching (\w+)@(\w+) and replacing with $2/$1 would swap the parts around the @ symbol.

Is my data processed on a server?

No. All regex testing happens entirely in your browser using JavaScript. No data is sent to any server. Your patterns and test strings remain completely private.