Contents

Engineering Craft › Developer Tooling

Regex Testers

Tools for building and testing regular expressions interactively.

Also known as: regex tester, regex101, regexr

Writing a regular expression by trial and error in your code is slow. Regex testers are web tools (such as regex101 and RegExr) where you paste a pattern and some sample text, and see the matches highlighted as you type.

What they show:

  • Matches and capture groups, highlighted in the sample.
  • An explanation of each part of the pattern, in plain language.
  • Which flavor you’re using (JavaScript, Python, PCRE, Go), since syntax differs slightly.
  • Flags (i ignore case, g global, m multiline).
  • Sometimes a step count, which warns about patterns that backtrack badly.
  • A substitution preview, for search and replace.
Pattern:  (\d{4})-(\d{2})-(\d{2})
Text:     Due 2026-10-10, paid 2026-10-12
Matches:  2026-10-10   groups: 2026 | 10 | 10
          2026-10-12

How to use one well

  1. Pick the right flavor for your language, since some features (lookbehinds, named groups) vary.
  2. Paste realistic sample text, including the cases that should not match.
  3. Build the pattern a little at a time, checking each step.
  4. Test edge cases: empty input, extra spaces, other languages and long lines.
  5. Copy the final pattern into your code, and add a comment.
  6. Add tests in your code with the same examples (regular expressions).

Cautions

  • Don’t paste secrets or personal data into an online tool.
  • A match in the tester isn’t a guarantee. Escaping rules differ once the pattern sits inside a string in your language ("\\d" vs r"\d").
  • Beware of catastrophic backtracking on untrusted input (ReDoS).
  • For simple text searching in files, the terminal’s grep may be enough.