Tool Guide

RegExp Tester

Test regular expressions with real-time highlighting, match details, and flag support. This guide explains how the tool behaves, how to work with common patterns, and some pitfalls to avoid when debugging regexes.

Overview

Tool

RegExp Tester

The RegExp Tester is a browser-based playground for regular expressions. It lets you type a pattern, toggle flags, and see matches highlighted in real time. It is designed to behave like JavaScript's RegExp, so what you see in the tool is what you'll get in your code.

Common usage patterns

Guide

Quick match testing

  • Paste or type your test text into the Input area.
  • Enter a regular expression pattern in the Pattern field (without or with slashes, depending on the UI).
  • Toggle flags like g, i, m, s, u, y as needed.
  • Watch matches and capture groups highlight in real time as you edit.

Guide

Using flags effectively

Flags can dramatically change how a pattern behaves. The tool makes this easy to see by updating matches instantly:

  • g – global, find all matches instead of just the first.
  • i – case-insensitive, useful for emails, tags, and user input.
  • m – multiline, treats ^ / $ as start/end of line instead of whole text.
  • s – "dotAll", makes . match newlines as well.
  • u – Unicode mode, better handling for emoji and non-ASCII characters.
  • y – sticky mode, matches starting exactly at lastIndex (advanced use cases).

Guide

Starting from templates

The tool can offer a set of common templates (email, URL, phone number, slug, etc.). When you select a template:

  • It fills in a known-good pattern as a starting point.
  • You can tweak it to match your exact use case instead of starting from scratch.
  • You still see real-time matches, so it's easy to understand what each change does.

Understanding matches & capture groups

Guide

Highlighting and match list

The RegExp Tester not only highlights matches in the input text, but can also show a structured list of matches:

  • Each match shows its index (start / end) in the input string.
  • Capture groups (e.g. (...)) are displayed with their own indices and values.
  • This makes it easier to translate what you see into code that uses exec, match, or matchAll.

Guide

Debugging broken patterns

When a pattern is invalid or behaves unexpectedly, the tool surfaces clear feedback instead of failing silently:

  • If the pattern cannot be compiled, you'll see an error message from the underlying JavaScript engine.
  • If a pattern is valid but matches nothing, you'll see zero matches instead of ambiguous behavior.
  • This helps distinguish "wrong syntax" from "pattern is valid but too strict".

Edge cases & gotchas

Guide

Greedy vs. lazy quantifiers

A very common source of bugs in regex is using greedy quantifiers (like .*) when you really wanted the shortest match:

  • .* is greedy — it matches as much as possible.
  • .*? is lazy — it matches as little as possible while still satisfying the whole pattern.
  • The tester makes it easy to see the difference visually as you toggle ? on and off.

Guide

Escaping special characters

Characters like ., +, *, ?, (, ), [, ], {, }, and | have special meanings in regex. To match them literally, you need to escape them with a backslash:

  • Use \. to match a literal dot.
  • Use \+ to match a plus sign, and so on.
  • The tester helps you experiment with escaping until the matches look right.

Guide

Newlines and multi-line input

When working with multi-line text, it's easy to forget how ^ and $ behave:

  • Without m (multiline), ^ / $ match the start / end of the whole input.
  • With m, they match the start / end of each line.
  • Combine with s (dotAll) when you want . to cross line boundaries.

How it works internally

Internals

Execution model

The RegExp Tester uses JavaScript's built-in RegExp engine under the hood, so its behavior matches what you get in browsers and Node.js:

  • The pattern and flags are used to construct a RegExp instance.
  • For global or sticky matches, the tool uses exec / matchAll to iterate over matches.
  • Match indices and capture groups are collected and mapped back to the UI for highlighting.

All execution happens in your browser. No pattern or input text is sent to Birdor's servers.

Internals

Safety & performance considerations

Regular expressions can be expensive or even vulnerable to "ReDoS" (Regular Expression Denial of Service) if written carelessly. The tester helps, but you should still:

  • Avoid patterns with catastrophic backtracking on untrusted input.
  • Prefer simpler, well-tested patterns for public-facing services.
  • Use the tool to experiment and then paste the final pattern into your codebase with tests.

Related tools & docs

Tools

In practice, you'll often use the RegExp Tester next to JSON and URL tools when building log scrapers, validators, and small code-mod scripts.