# Regex Tester

URL: https://hifreetools.com/developer/regex-tester

> Test JavaScript regular expressions instantly in your browser. Enter a pattern, add flags like g for global or i for case-insensitive, and see every match listed with a count. Perfect for debugging regex before you use it in code.

## Quick answer

A regex tester lets you write a pattern and see what it matches in real text, showing each match and the total count. Use it to debug patterns before using them in code—test whether your pattern finds what you expect without guessing.

Enter a JavaScript regular expression pattern without the surrounding slashes (like \d+ or [A-Z]+) and optional flags (g for global, i for case-insensitive, m for multiline, etc.). Paste or type the text you want to test. The tool will instantly show every match found, the matched text for each, and the total count of matches. Results update as you type.

## Examples

- Find all numbers: Pattern: /\d+/g | Text: a12b3 → Matches: 12, 3 | Count: 2
- Case-insensitive word match: Pattern: /hello/i | Text: Hello there → Matches: Hello | Count: 1
- Find 5-letter words: Pattern: /\b\w{5}\b/g | Text: The quick brown fox → Matches: quick, brown | Count: 2

## FAQ

**What flags can I use?**
JavaScript regex supports: g (global - find all matches), i (case-insensitive), m (multiline - ^ and $ match line starts/ends), s (dotAll - . matches newlines), u (Unicode), y (sticky), d (match indices), and v (Unicode sets). Combine them in the Flags box, like gim.

**Is my data uploaded or stored?**
No. Everything runs in your browser. Your regex patterns and test strings never leave your device.

**What's the difference between test and match?**
This tool shows matches (the actual text that was found). A 'test' would just return true/false. This tool is more useful for seeing exactly what was matched.

**Can I match newlines?**
Yes. Use \n to match a newline, or add the m flag so that ^ and $ match line boundaries instead of just the string boundaries. Use the s flag to make . match newlines too.

**Why is my pattern not matching anything?**
Common reasons: forgetting to escape special characters (use \. to match a literal dot, \+ for a literal plus), wrong flags (add i for case-insensitive), or character class mistakes ([a-z] matches one letter, not a whole word).

**Can I use lookahead or lookbehind?**
Yes. JavaScript regex supports positive lookahead (?=...), negative lookahead (?!...), positive lookbehind (?<=...), and negative lookbehind (?<!...).


## Sources

- [MDN - Regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions)
- [ECMAScript specification - RegExp objects](https://tc39.es/ecma262/#sec-regexp-objects)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Regex Tester", https://hifreetools.com/developer/regex-tester
