PXLTools

Regex Tester

Test regex patterns with live matching and explanations

//g
Flags:
Presets:
Match highlights appear here...

How to use Regex Tester

  1. Type or paste your regular expression into the input field.
  2. Toggle flags (g, i, m, s, u) based on your needs.
  3. Paste the text you want to test into the 'Test string' area.
  4. Matches are highlighted automatically, with capture groups listed below.
  5. Switch to Replace mode to test regex-based text replacement.

What is a regular expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. Regexes are used for string matching, validation, search-and-replace, parsing, and many other text-processing tasks.

While powerful, regexes can be tricky to write and debug. A testing tool like this one gives you instant feedback: you can see which parts of your input match, which capture groups get populated, and which characters the pattern is consuming.

When in doubt, start simple. Build up your pattern one piece at a time and verify each step. Complex regexes are often easier to read when broken into a commented, multi-line form — though browsers do not support that syntax natively, so you will need to write it inline for web usage.

Frequently Asked Questions

What regex flavor does this tool support?
This tool uses the JavaScript regular expression engine (ECMAScript 2020+). Most features are similar across regex flavors, but some advanced features (like lookbehind, named groups, unicode property escapes) work differently in Python, PHP, or other languages.
What do the flags mean?
g = global (find all matches, not just the first). i = case-insensitive. m = multiline (^ and $ match start/end of each line, not just the whole string). s = dotAll (. matches newline characters). u = unicode (enable full Unicode support). y = sticky (matches only from lastIndex position).
Why do I get an "Invalid regular expression" error?
Common causes: unbalanced parentheses or brackets, an unescaped special character (like . + * ? ( ) [ ] { } |), or an incomplete escape sequence. The error message usually points to the problem.
How do I capture groups?
Wrap the portion you want to capture in parentheses (). Each group is numbered starting at 1. You can also name groups using (?<name>...). Use (?:...) for a non-capturing group when you need grouping without a capture.
Are my regex and test string stored anywhere?
No. Everything runs locally on your device. Nothing is sent to any server.