Report

Help us improve this tool

Regex Tester

Test regular expression patterns against text with real-time matching, flags support, and detailed match results. Free online regex tester.

O M T

What is a Regex Tester?

A regex tester is an interactive online tool that lets you test regular expression patterns against text in real time. You can write a regex pattern, choose matching flags, and see all matches instantly highlighted in the input text. Each match displays its position, captured groups, and named groups, making it easy to debug and refine your regular expressions.

How to Use the Regex Tester

Enter your regular expression pattern in the Regex field. Type or paste the text you want to test in the Test Text field. The matches will appear automatically on the right side. Use the flags checkboxes to modify how the pattern is interpreted: enable g for global matching, i for case-insensitive matching, m for multiline mode, s for dotall mode, and u for Unicode mode.

Understanding Regex Flags

The global flag (g) finds all matches rather than stopping at the first one. The case-insensitive flag (i) makes the pattern match uppercase and lowercase letters interchangeably. Multiline mode (m) changes the behavior of the ^ and $ anchors so they match at the start and end of each line rather than the entire string. The dotall flag (s) allows the dot metacharacter to match newline characters. Unicode mode (u) treats the pattern as a sequence of Unicode code points and enables additional Unicode features.

Reading Match Results

Each match displays its starting index in the text, the matched value, and any captured groups. Capturing groups are shown as $1, $2, etc. based on their position in the pattern. Named groups appear with their specified names. The position range [start-end] shows where each capture begins and ends in the original text. The highlighted view makes it easy to see where matches occur visually. For a complete reference of regex syntax, check our Regex Memo cheat sheet.

Frequently Asked Questions

Why is my regex not matching anything?

Check that your pattern syntax is correct. Common issues include missing escape characters for special metacharacters, incorrect quantifier placement, or mismatched brackets. Make sure the appropriate flags are enabled. For example, if your pattern is case-sensitive and the text contains uppercase letters, enable the i flag or adjust your pattern accordingly.

What is the difference between capturing and non-capturing groups?

Capturing groups, written as (pattern), save the matched text for later use via backreferences. Non-capturing groups, written as (?:pattern), group parts of the pattern without saving the matched text. Use non-capturing groups when you need grouping for quantifiers but do not need to reference the captured value.

How do I match multiline text with regex?

Enable the multiline flag (m) so that the ^ anchor matches the start of each line and the $ anchor matches the end of each line. Also enable the dotall flag (s) if you need the dot to match newline characters. Without these flags, ^ and $ only match the start and end of the entire string.

What regex engine does this tool use?

This tool uses the JavaScript regular expression engine built into modern web browsers. It supports most common regex features including character classes, quantifiers, capturing groups, named groups, lookahead, lookbehind, and backreferences. Some advanced features like atomic groups and possessive quantifiers are not supported.

Can I use this regex tester offline?

Yes, all processing happens entirely in your browser using JavaScript. Your regex patterns and test text never leave your device. No data is sent to any server, making this tool safe for testing patterns that may contain sensitive information.