Regex Tester
Test and debug regular expressions with real-time matching.
How it works
- 1
Enter a pattern
Type your regular expression in the pattern field.
- 2
Add test text
Enter test strings in the text area below.
- 3
See matches highlighted
Matches are highlighted in real-time. Toggle flags like global, case-insensitive, and multiline.
Common use cases
Email pattern
/[\w.-]+@[\w.-]+\.\w+/g
Date extraction
/\d{4}-\d{2}-\d{2}/g
About This Tool
Write a regular expression and instantly see matches highlighted in your test string. Supports JavaScript regex flags (global, case-insensitive, multiline, dotAll, unicode). Shows match groups, capture groups, and match indices.
Ideal for building and debugging regex patterns for form validation, text parsing, log analysis, and data extraction.
Regular expressions are a powerful pattern-matching language used in virtually every programming language, text editor, and command-line tool. Despite their power, regex syntax is notoriously difficult to read and debug -- a single misplaced character can completely change the behavior. This tool gives you instant visual feedback so you can see exactly what your pattern matches (and what it does not) as you type.
The tester uses JavaScript RegExp engine under the hood, which means the results are exactly what you would get in your JavaScript code, Node.js scripts, or any tool that uses the V8 regex engine. It supports all JavaScript regex features including lookahead assertions (?=...), lookbehind assertions (?<=...), named capture groups (?<name>...), Unicode property escapes (\p{L}), and backreferences (\1).
Flags control the matching behavior. The g (global) flag finds all matches rather than stopping at the first. The i (case-insensitive) flag makes the pattern ignore case. The m (multiline) flag makes ^ and $ match the start and end of each line rather than the entire string. The s (dotAll) flag makes . match newlines. The u (unicode) flag enables Unicode mode for proper handling of characters outside the BMP.
Real-world use cases: building an email validation pattern for a form, extracting dates from unstructured text, parsing log lines for error codes, creating a password strength checker, finding and replacing patterns in a large text file, and testing a pattern before using it in a grep or sed command. Each match is highlighted in the test string with its position and captured groups displayed below.
Tips: start with a simple pattern and add complexity gradually. Use named groups to make your regex self-documenting. Test edge cases like empty strings, strings with special characters, and very long inputs. If your pattern causes the tool to time out, it may suffer from catastrophic backtracking -- try simplifying nested quantifiers.
More examples
Examples
Email pattern
Input
/[\w.-]+@[\w.-]+\.\w+/g
Output
Matches: user@example.com, support@utiliify.com
Date extraction
Input
/\d{4}-\d{2}-\d{2}/gOutput
Matches: 2025-01-15, 2024-12-31
Frequently Asked Questions
- What is a regular expression?
- A regular expression (regex) is a sequence of characters that defines a search pattern. It is used for pattern matching within strings -- for validation, search, and text manipulation.
- Which regex flavor does this use?
- This tool uses JavaScript's built-in RegExp engine, which supports features like lookahead, lookbehind, named groups, and Unicode property escapes. Results match what you'd get in JavaScript code.
- Can I use regex flags?
- Yes. Toggle flags like global (g), case-insensitive (i), multiline (m), dotAll (s), and unicode (u) with the flag buttons.
- Will complex patterns freeze my browser?
- This tool includes a time limit to prevent catastrophic backtracking. If a pattern takes too long, matching is stopped and you will see a warning. Try simplifying your regex if this happens.
- What are capture groups?
- Capture groups are portions of your regex enclosed in parentheses (). Each group captures the text it matches, which you can reference later. Named groups like (?<name>...) give groups readable names.
- How do I match a literal dot or asterisk?
- Prefix special characters with a backslash to match them literally. Use \. to match a literal dot, \* for an asterisk, \+ for a plus sign, and \\ for a literal backslash.
- What is catastrophic backtracking?
- Some regex patterns with nested quantifiers (like (a+)+) can cause exponential time complexity on certain inputs. The engine tries every possible combination before failing. This tool detects and stops such patterns.