Regex tester
Test regular expressions with inline highlighting, capture groups, replace mode, and a built-in cheat sheet. All JavaScript regex flags supported.
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
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
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
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
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
JSON Formatter & Validator
Pretty-print and validate JSON with 2 / 4 space indentation.
JSON to CSV Converter
Convert JSON arrays to CSV format. Auto-detects columns, proper escaping, download as .csv.
CSV to JSON Converter
Convert CSV data to a JSON array of objects. Handles quoted fields and commas.
HTML Formatter & Minifier
Beautify messy HTML with proper indentation or minify it for production.
HTML Minifier
Minify HTML by stripping comments, collapsing whitespace. Shows size savings.
CSS Formatter & Minifier
Beautify CSS with proper indentation or minify it for production. Strips comments.