Yantrasagaram

Regex Tester

Regular expressions are indispensable for searching, validating, and transforming text, but building them correctly often means hours of trial and error. This free regex tester lets you write a pattern, choose your flags, and instantly see every match highlighted in your test string. Pair it with the JSON Formatter when extracting patterns from API responses. Each match displays its index position and any captured groups, so you can verify that your parentheses extract exactly the data you need. Toggle the global, case-insensitive, multiline, and dotAll flags with checkboxes instead of memorizing syntax. Building regex for URL validation? Encode test URLs with the URL Encoder / Decoder to see how special characters transform. Invalid patterns surface clear error messages inline, helping you fix typos before they reach production code. Everything runs locally in your browser using the native JavaScript RegExp engine — no data is transmitted, no account is required, and results update in real time as you type.

Flags

How to Use This Tool

  1. Enter your regular expression pattern in the pattern input field. Do not include the surrounding slashes — just the pattern itself.
  2. Select the flags you need: global (g) for multiple matches, case-insensitive (i), multiline (m) for line-by-line anchoring, or dotAll (s) to make the dot match newlines.
  3. Paste or type your test string into the textarea. Matches highlight in real time as you type both the pattern and the test string.
  4. Review the highlighted output and the match details list below it. Click Copy Matches to copy all match data to your clipboard.

Examples

Extract Email Addresses

Pattern

[\w.+-]+@[\w-]+\.[\w.]+

Test string

Contact us at support@example.com or sales@company.co.uk

Result

2 matches: "support@example.com" at index 17, "sales@company.co.uk" at index 41

Parse Dates with Captured Groups

Pattern

(\d{4})-(\d{2})-(\d{2})

Test string

Released on 2024-01-15 and updated on 2024-06-30.

Result

2 matches with groups: "2024", "01", "15" and "2024", "06", "30"

Validate IP Addresses

Pattern

\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b

Test string

Server 192.168.1.1 responded, but 10.0.0.255 timed out.

Result

2 matches: "192.168.1.1" at index 7, "10.0.0.255" at index 33

What This Tool Is Useful For

Frequently Asked Questions

Does this regex tester support all JavaScript regex features?
Yes. The tool creates a native JavaScript RegExp object in your browser, so every feature your browser supports — including named groups, lookbehind assertions, and Unicode property escapes — works here. The available flags are global (g), case-insensitive (i), multiline (m), and dotAll (s).
Why does my pattern show zero matches even though it looks correct?
The most common reasons are a missing global flag when you expect multiple matches, or a case mismatch when the case-insensitive flag is off. Check that your flags are set correctly. Also verify that special characters like parentheses, brackets, or dots are escaped with a backslash if you intend them as literals.
Is my test data sent to a server?
No. All matching happens locally in your browser using JavaScript's built-in RegExp engine. No patterns, test strings, or results leave your device.
What are captured groups and when should I use them?
Captured groups are portions of a match enclosed in parentheses in your pattern. For example, (\d{3})-(\d{4}) applied to '555-1234' produces two groups: '555' and '1234'. Groups are useful for extracting specific parts of a match, such as pulling the domain from an email address or the year from a date string.
How do I match across multiple lines?
Enable the multiline (m) flag so that ^ and $ match the start and end of each line rather than the entire string. If you also need the dot (.) to match newline characters, enable the dotAll (s) flag as well.

More Developer Tools

Generate secure credentials with the Password Generator. Format and validate structured data with the JSON Formatter & Validator. Encode binary data with the Base64 Encoder / Decoder. Create unique identifiers with the UUID Generator. Browse all utilities in the Developer Tools hub.

Related Tools