Regex Tool

Regular expressions are compact, powerful and extremely easy to get subtly wrong. A pattern that looks correct may match more than you intended, backtrack catastrophically on a long input, or quietly miss the one edge case that matters. Testing interactively against real sample text is the only reliable way to know what a pattern actually does.

This tester highlights matches as you type, so you can see the effect of every change immediately. Building a pattern in small increments is far more productive than writing a long expression and debugging it afterwards: match the simplest case first, then extend it, checking after each addition that you have not broken what already worked.

Include deliberately awkward samples in your test text. Empty strings, unusual punctuation, accented characters, very long inputs and near-misses that should not match are where patterns fail in production. And resist the temptation to parse HTML or validate email addresses with a single monstrous expression; use a proper parser for structured formats.

How to use the Regex Tool

  1. Enter your regular expression in the pattern field.
  2. Set the flags you need, such as global, case-insensitive or multiline.
  3. Paste realistic sample text, including cases that should not match.
  4. Review the highlighted matches and any captured groups.
  5. Refine the pattern in small steps until every sample behaves correctly.

Examples

Frequently asked questions

Which flavour of regex is used?

JavaScript regular expressions, as implemented by your browser. Most syntax is shared with other languages, but lookbehind and named group support can differ elsewhere.

What does the global flag change?

Without it, only the first match is returned. With it, the pattern continues scanning and finds every match in the text.

Why is my pattern extremely slow?

Nested quantifiers can cause catastrophic backtracking on certain inputs. Make the inner parts more specific or avoid overlapping repetition.

Should I use regex to validate email addresses?

A simple sanity check is fine, but full validation is best done by sending a confirmation message. The formal grammar is far more complex than most patterns assume.

SwiftMultiTool — free online tools for everyone. Home · Blog · About · FAQ · Contact