Notification
Go to Home All Tools Compare Glossary Blog Contact

Regex Tester

Test and debug regular expressions online in real time, with live match highlighting, capture group extraction, and support for common regex flags.

Regex Pattern

Expression Configuration

/ / g
RegExp Flags
Snippet Templates

Common Regex Presets

Quick Reference

Regex Cheat Sheet

. Any single character except newline
\d / \D Digit / Non-digit characters
\w / \W Word / Non-word alphanumeric
\s / \S Whitespace / Non-whitespace spaces
^ / $ Start / End anchors of string
* / + Matches 0 or more / 1 or more times
? Lazy quantifier / Optional matcher
(xyz) / [xyz] Captured group / Custom character set
Test Area

Subject String Text

Match Count: 0 matches
Breakdown Dashboard

Active Matches & Capture Groups

No active matches Please construct a valid regular expression pattern and provide test string text.
Code Assistant

AI Regex Consultant

Ask AI
Education

Complete Guide to Mastering Regular Expressions (Regex)

01

Character Classes & Shorthand Sequences

Character classes define specific sets of characters to match. Shorthand sequences streamline pattern writing: \w matches any alphanumeric word character (A-Z, a-z, 0-9, _), \s matches any whitespace character (spaces, tabs, newlines), and \d targets numeric digits. Capitalizing shorthand characters (e.g., \W, \S, \D) inverts the match, targeting everything except that specified set.

02

Greedy vs. Lazy (Non-Greedy) Quantifiers

Quantifiers like *, +, and {n,m} specify how many times a character or group must repeat. By default, quantifiers are greedy—they consume as much text as possible while still matching the overall pattern. Appending a question mark (e.g., *? or +?) switches matching to lazy mode, causing the engine to consume the absolute minimum number of characters required.

03

Position Anchors & Word Boundaries

Anchors enforce positional constraints without consuming characters. The caret ^ asserts the start of a string or line, while the dollar sign $ asserts the end. Word boundaries (\b) match the positions where a word character (\w) transitions to a non-word character (\W), allowing you to target whole words rather than substrings.

04

Capturing Groups vs. Non-Capturing Groups

Parentheses ( ) create capturing groups, allowing you to isolate and extract specific sub-segments from a match or reuse them via backreferences. If you only need to group expressions for logical operations (like OR conditions with |) without saving the extracted text, use non-capturing groups (?:pattern) to optimize memory and processing speed.

05

Regex Execution Flags & Modifiers

Flags modify how the regular expression engine parses test strings. Beyond standard global (g) and case-insensitive (i) search modes, the multiline flag (m) changes ^ and $ to match the start and end of each individual line, while dotAll (s) allows the dot (.) token to match newline characters (\n), and unicode (u) enables full UTF-16 surrogate pair processing.

06

Preventing Catastrophic Backtracking

Catastrophic backtracking occurs when nested quantifiers or overlapping optional patterns force the regex engine to evaluate exponential state combinations on non-matching inputs, causing high CPU usage or browser freezes. To write safe, performant regex, avoid nesting ambiguous quantifiers like (a+)+ and use atomic grouping or specific character classes instead of wildcard dot (.) matchers.

Good to know

Questions, answered

Quick answers about how this tool works.

The global flag g instructs the regex engine to search for all matching occurrences in the string rather than stopping after the first match.

The i flag enables case-insensitive matching so that uppercase and lowercase letters are treated identically.

A standard regex for email validation is ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

Use \d+ or [0-9]+ to match one or more numerical digits.

A lookahead (?=...) asserts that a specific pattern follows the current position without consuming characters in the match.

Type your pattern and test string into our Regex Tester tool for real-time match highlighting and group extraction.

What do you need to work out next?

Search 190+ free tools by name, or pick a category below. Every one runs instantly in your browser — no signup, nothing to install.

More Developer Tools