Regex Tester
Test and debug regular expressions in real-time. Live match highlighting, capture groups, substitution preview, and pattern explanation. 100% client-side — nothing leaves your browser.
How to use the regex tester
Testing regular expressions doesn't need to be painful. Three steps and you're matching.
Enter your pattern
Type your regex in the pattern field. The tester validates it in real-time and shows whether the pattern is valid or has syntax errors. No need to press "run."
Set your flags
Toggle flags like global (g), case-insensitive (i), or multiline (m) using the buttons in the toolbar. The flags are reflected in the pattern display instantly.
Paste your test string
All matches highlight in the test string as you type. The Matches tab shows full match details — capture groups, named groups, and index positions for every hit.
Use replace mode
Click "Replace" to enable substitution. Enter a replacement string using $1, $2, $& backreferences and see the transformed result update live below the test area.
Common regex patterns every developer should know
These patterns cover 90% of everyday regex tasks. Click "Library" in the toolbar to load any of them instantly.
Email validation
Match email addresses with [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}. Covers standard formats without being overly strict — perfect for form validation.
URL matching
Extract URLs with https?://[^\s/$.?#].[^\s]*. Handles http and https, query strings, fragments, and paths. Use capture groups to extract components.
IP address
Validate IPv4 with \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b. For strict validation (0-255 per octet), use alternation with ranges: (25[0-5]|2[0-4]\d|[01]?\d\d?).
HTML tags
Match opening tags with <([a-z][a-z0-9]*)\b[^>]*>. Group 1 captures the tag name. Remember: for complex HTML parsing, use a proper parser — regex is fine for quick extraction.
Numbers & currency
Match currency like \$[\d,]+\.?\d* or any decimal with -?\d+\.?\d*. Capture groups let you separate dollars from cents: \$(\d+)\.(\d{2}).
Date formats
Match ISO dates with \d{4}-\d{2}-\d{2} or US dates with \d{1,2}/\d{1,2}/\d{2,4}. Named groups make extraction clean: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}).
Frequently asked questions
What regex engine does this tester use?
This tester uses JavaScript's native RegExp engine, which is ECMAScript-compliant. This is the same engine used in all major browsers and Node.js. If your regex works here, it works in JavaScript.
What are capture groups and how do I use them?
Capture groups are created with parentheses (). They extract parts of a match. For example, (\d{4})-(\d{2})-(\d{2}) on "2024-01-15" gives Group 1: "2024", Group 2: "01", Group 3: "15". Named groups use (?<name>...) syntax for readability.
What do the different flags do?
g (global) finds all matches instead of just the first. i ignores case. m makes ^ and $ match line boundaries, not just string boundaries. s makes . match newlines too. u enables Unicode support. y (sticky) matches only at the lastIndex position.
How does substitution work?
Click "Replace" in the toolbar, then enter a replacement string. Use $1, $2 etc. for numbered group backreferences, $& for the full match, $` for text before the match, and $' for text after. Named groups use $<name>.
Is my data safe?
Completely. This tool runs 100% in your browser using JavaScript. No data is sent to any server. Your patterns and test strings are never stored, logged, or transmitted anywhere. Check the network tab in DevTools if you want proof.
Why does my regex work differently in Python/PHP/Java?
Different regex engines have different features and syntax. JavaScript doesn't support lookbehinds in older browsers, possessive quantifiers, or atomic groups. This tester uses JavaScript's engine specifically. For other engines, check engine-specific documentation.
More free tools
Password Generator
Strong random passwords with strength meter & batch mode
JSON Formatter
Format, validate, and beautify JSON instantly. Syntax highlighting, error detection, minification.
Color Contrast Checker
Check text/background color combinations for WCAG 2.1 AA and AAA compliance. Built-in color picker and accessible color suggestions.
Code Formatter
Format XML, SQL, CSS, HTML, and JavaScript instantly. Syntax highlighting, minification, line numbers.
QR Code Generator
Generate QR codes for URLs, WiFi, contacts, and email. Custom colors and sizes. PNG & SVG download.
Word Counter
Real-time word count, character count, readability score, keyword density, reading time, find & replace, case converter, and more.
Reverse Image Search
Search by image across Google Lens, TinEye, Yandex, and Bing. Upload, paste, or enter a URL.
Mortgage Calculator
Calculate monthly payments with amortization schedule, payment breakdown charts, and CSV export.
Interest Calculator
Calculate simple and compound interest with growth charts and year-by-year breakdowns.
Text Diff Tool
Compare two texts with color-coded additions, deletions, and changes. Side-by-side view.