Free Regex Tester Online
Test regular expressions with real-time match highlighting, flag support, and capture group display.
Key Features
Everything you need to test and debug regular expressions
Matches are highlighted in the test text instantly as you type, making it easy to see what your pattern captures.
Each match is listed with its position and any capture groups so you can inspect results precisely.
Browser-side workflows run locally in your browser. Avoid entering sensitive text unless local processing is clearly shown.
Key Takeaways
- The tester runs entirely in your browser using the JavaScript RegExp engine, so matching happens in real time as you edit the pattern or text, an invalid pattern shows the exact error inline, and your input stays on your device.
- Leave the g flag off to validate a single value and return only the first match, or turn g on to scan the whole text and list every match with its start-to-end character position.
- Wrap parts of your pattern in parentheses to create capture groups, and each numbered group is shown beside its match so you can confirm exactly what was captured.
- Because it uses the JavaScript engine, results match JavaScript and Node.js exactly, so patterns written for Python, PHP, or PCRE may need adjusting for features like lookbehind or named groups before testing.
How to Test a Regular Expression Online
Enter your pattern and flags
Type your regular expression into the pattern field, without the enclosing slashes. Toggle the g, i, m, and s checkboxes to set global, case-insensitive, multiline, and dotAll behavior. The pattern is compiled with the browser JavaScript RegExp engine, so an invalid pattern reports the exact error message inline.
Add your test text
Paste or type the sample text you want to match against in the test text area. Matching runs in real time as you edit either field, so there is no separate submit step in normal use. You can also click Test to re-run, or Clear to reset both fields and results.
Review highlighted matches and groups
Every match is highlighted inline in the output area and listed below with its sequence number, matched value, and start-to-end character position. When your pattern uses parentheses, each numbered capture group is shown next to its match so you can confirm exactly what was captured.
Regex Flags Supported by This Tester
This tool exposes the four most common JavaScript regex flags as checkboxes. Each one changes how the same pattern behaves against your test text. Use this table to pick the right combination for the result you expect.
| Flag | Name | What it does | Typical use |
|---|---|---|---|
| g | Global | Finds every match in the text instead of stopping at the first one. | Counting or extracting all occurrences. |
| i | Case-insensitive | Ignores upper and lower case differences when matching. | Matching words regardless of capitalization. |
| m | Multiline | Makes ^ and $ match the start and end of each line, not just the whole string. | Line-by-line patterns in multi-line input. |
| s | dotAll | Lets the dot match newline characters as well as everything else. | Matching across line breaks with a single dot. |
| g + i | Combined | Returns all matches while ignoring case. | Bulk find across mixed-case text. |
Which Setup Fits Your Task
Validate a single value
Leave the g flag off to test one value such as an email or postal code. With no global flag the tester returns the first match only, which mirrors how a single validation check behaves in code.
Extract all occurrences
Turn on the g flag to scan the whole text and list every match with its position. This is the right mode when you need to pull all dates, URLs, or tokens out of a block of text.
Capture parts of a match
Wrap sections of your pattern in parentheses to create capture groups, for example (\d{4})-(\d{2}). Each numbered group appears beside its match so you can verify the pieces you intend to reuse.
Match across multiple lines
Combine the m flag, so ^ and $ anchor per line, with the s flag, so the dot spans line breaks. Together they handle log lines and other multi-line input where line boundaries matter.
Common Problems and Fixes
Invalid regex error appears
The status line shows the exact JavaScript error, usually from an unbalanced bracket or parenthesis or a stray backslash. Check that every ( and [ has a closing partner, and remember to escape literal special characters such as . or ? with a backslash.
Only the first match is found
Without the g flag the engine stops after the first match. Enable the g checkbox to find and list every match in the text. If you still see one result, confirm your pattern is not over-anchored with ^ or $.
The dot is not matching newlines
By default the dot does not cross line breaks. Enable the s (dotAll) flag so the dot matches newline characters, which is needed when a single pattern should span more than one line of text.
Pattern behaves differently than in another language
This tester uses the browser JavaScript RegExp engine, so results match JavaScript and Node.js exactly. Patterns written for Python, PHP, or PCRE may use syntax such as lookbehind or named groups that differ slightly, so adjust them for JavaScript before testing.
About the Regex Tester
Regular expressions are patterns used to match, search and manipulate text. This free regex tester lets you enter a pattern and test it against any text, showing all matches highlighted inline and listed with positions and groups. It uses the JavaScript RegExp engine and supports the g, i, m and s flags. Everything runs in your browser with no data sent to any server.
Frequently Asked Questions
Is this tool completely free?
Yes. The tool is 100% free to use with no registration, no subscription and no usage limits.
You can use it as many times as you need for personal or commercial projects without any cost.
We believe developer and productivity tools should be accessible to everyone without paywalls.
What do the regex flags do?
The g flag finds all matches in the text instead of stopping after the first. The i flag makes matching case-insensitive.
The m flag makes ^ and $ match the start and end of each line rather than the whole string.
The s flag (dotAll) makes the dot character match newlines as well as other characters.
How do I use capture groups?
Wrap part of your pattern in parentheses to create a capture group, for example (\d+) to capture a sequence of digits.
The match list will show each group value alongside the full match so you can see exactly what was captured.
Named groups using the (?
What regex engine does this tool use?
The tool uses the JavaScript RegExp engine built into your browser, so results match exactly what you would get in a JavaScript application.
This makes it ideal for testing patterns intended for use in front-end JavaScript or Node.js projects.
Patterns for other languages such as Python or PHP may differ slightly in syntax and behavior.
Works in Chrome, Firefox, Safari, Edge, Opera, and other modern browsers on Windows, macOS, Linux, Android, and iOS. No software installation or sign-up required. All conversions run directly in your browser, so your files never leave your device and are never uploaded to a server. Free to use with no account needed.
Sources and References
Format and tool details on this page are based on the official specifications and documentation below.
- Regular expressions- MDN Web Docs