Regex Tester Online
Test regular expressions against text with real-time match highlighting. Supports all JavaScript regex flags.
Invalid: @broken, test@, @.com
What is Regex?
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used for string matching, validation, search-and-replace, and text parsing in virtually every programming language.
Common Regex Flags
g (global) finds all matches. i (case insensitive) ignores case. m (multiline) treats ^ and $ as line boundaries. s (dotall) makes . match newlines.
About This Tool
The Regex Tester lets you write and test regular expressions against sample text in real time. Match highlights update instantly as you type your pattern, making it easy to validate, debug, and refine regular expressions for search, validation, and text processing tasks.
Key Features
- Live Match Highlighting — Highlights all pattern matches in your test string in real time as you type, with no button press needed.
- Flags Support — Toggle standard regex flags: g (global), i (case-insensitive), m (multiline), and s (dot-all) to control match behavior.
- Match Details — Shows the number of matches found, their positions, and captured group values for each match.
- Browser-Based Processing — All regex execution runs locally in your browser using the JavaScript RegExp engine. Your text never leaves your device.
- Free & No Signup — Use this tool as many times as you need without creating an account or paying anything.
Common Use Cases
- Validating that user-entered email addresses, phone numbers, or postal codes match expected formats
- Extracting specific data patterns such as dates, prices, or identifiers from raw text strings
- Testing search-and-replace patterns before using them in a code editor, database query, or shell script
- Debugging complex regex patterns by breaking them into parts and testing each section independently
- Learning regular expression syntax interactively with immediate visual feedback
How to Use
Enter your regular expression in the Pattern field (without surrounding slashes). Select any flags you need using the checkboxes. Paste or type your test string in the Test String area. Matches are highlighted in the string and listed with their positions below.
Frequently Asked Questions
What is the difference between the g flag and no flag in regex?
Without the g (global) flag, the regex stops after finding the first match. With g, it finds all non-overlapping matches in the string. Most practical use cases (replace-all, extract-all) require the g flag.
What are capturing groups and how do they work?
Wrapping part of a pattern in parentheses (e.g., (\d4)) creates a capturing group. The matched content is saved separately. For example, (\d4)-(\d2)-(\d2) matching 2024-01-15 gives group 1=2024, group 2=01, group 3=15.
What is catastrophic backtracking?
Catastrophic backtracking occurs when a poorly written regex takes exponential time to determine there is no match, causing the browser or server to freeze. Avoid nested quantifiers like (a+)+ on large inputs.
Does this tool use JavaScript regex or another engine?
This tool uses JavaScript's built-in RegExp engine. JavaScript regex is largely compatible with PCRE (Perl-Compatible Regular Expressions) but has some differences, such as no lookbehind support in older engines and no possessive quantifiers.
Related Tools
Workflow Links
Suggested step-by-step tools based on this page intent.
Before This Tool