Regex Tester
Enter a pattern to see matches in your test string.
Regex Tester lets you check a regular expression against any sample text right in your browser. Type a pattern, pick the flags you need (global, ignore case, multiline, dot all), and paste your test string. You get every match with its position, any capture groups, and a running count. If the pattern is invalid, the tool shows the error instead of breaking. Nothing leaves your device.
How to use
- Type your regular expression in the Pattern field. Enter it without the surrounding slashes.
- Choose the flags you want: global to find all matches, ignore case, multiline, or dot all.
- Paste or type the text you want to test in the Test string box.
- Read the results below: each match shows its value, its index in the text, and any capture groups, along with the total count.
- If the pattern is invalid, fix it using the error message shown, then try again.
Examples
- Pattern \d+ with the global flag against "a1b22c333" returns 3 matches: "1" at index 1, "22" at index 3, and "333" at index 6.
- Pattern (\w+)@(\w+) against "user@host" returns 1 match with capture groups "user" and "host".
- Pattern abc with the ignore case flag against "ABC" returns 1 match, "ABC" at index 0.
FAQs
- Do I include the slashes around my pattern?
- No. Enter only the pattern itself, for example \d+ rather than /\d+/g. Set the flags using the checkboxes instead of writing them after a closing slash.
- Why do I only get one match?
- Without the global flag a regular expression stops at the first match. Turn on the global (g) flag to find every match in the test string.
- What do the flags mean?
- Global (g) finds all matches instead of just the first. Ignore case (i) makes matching case insensitive. Multiline (m) makes the anchors caret and dollar match at line breaks. Dot all (s) lets the dot match newline characters.
- What is the index next to each match?
- It is the zero based character position where that match starts in your test string. The first character is at index 0.
- Does my data get uploaded anywhere?
- No. The matching runs entirely in your browser using the built-in JavaScript regular expression engine. Your pattern and text never leave your device.
- Which regex syntax does this support?
- It uses the JavaScript (ECMAScript) regular expression engine, the same one used in web browsers and Node.js, so character classes, quantifiers, groups, and lookarounds all work as they do in JavaScript.
Related tools
- JSON FormatterFormat, validate, and beautify JSON in your browser. Paste messy JSON, get clean indented output, then copy it back. Free, no signup.
- Query String ParserParse a URL query string into key and value pairs, or build one from pairs. Handles a leading question mark, repeated keys, and encoded values.
- Find and ReplaceFind and replace text online. Case insensitive, whole word, and regex modes with a live replacement count. Runs in your browser.
- Hash GeneratorGenerate SHA-1, SHA-256, SHA-384, and SHA-512 hashes of any text in your browser. Fast, private, and copy ready.
- Base64 EncoderEncode text to Base64 or decode Base64 back to text in your browser. Full UTF-8 support and clear errors on invalid input.
- URL EncoderPercent encode and decode text for URLs in your browser. Toggle direction, copy results, and see clear errors on malformed input.