Regex Tester

Test a regular expression against sample text with live match highlighting and capture groups.

Regular expressions are how you find a needle in a log file, and in security work you write them constantly — for grepping evidence, for detection rules, and occasionally for input validation, where they are also a classic source of bugs.

How to use it

  1. Type a pattern into Pattern.
  2. Paste sample text into Test text.
  3. Watch matches highlight live as you refine the expression.

What to take away

Build patterns incrementally

Start with something that matches too much, then tighten. Writing a long expression in one go and debugging it afterwards is how you lose an afternoon.

Anchors matter for validation

A pattern without ^ and $ matches anywhere inside the string. A validator checking for a safe value without anchoring can be defeated by putting the safe value next to a dangerous one.

Regex is the wrong tool for HTML and for blocklists

Filtering XSS or SQL injection by pattern-matching bad strings fails, because the space of encodings is effectively infinite. Parameterised queries and proper encoding fix those; regex does not.

Frequently asked questions

What is catastrophic backtracking?

Some patterns with nested quantifiers take exponential time on crafted input, so a short string can hang a server. That is a denial-of-service bug known as ReDoS, and it is a real finding in real assessments.

What are the most useful pieces to learn first?

\d for digits, \w for word characters, . for anything, + and * for repetition, ^ and $ for anchors, and parentheses for capture groups. That handful covers most log-hunting work.

Do all tools use the same regex syntax?

No. This tester uses JavaScript regex. grep, Python and PCRE differ in the details — lookbehind support and escaping especially — so test in the environment you will actually run in.

Where this fits in the course

This security tool pairs with Path 04 — Python — see all 26 learning paths.

It runs entirely in your browser: nothing is uploaded, no account is needed, and it is free.

Related

  • Log Grep / Filter Playground — Filter a block of log lines with a regex — the exact "find the signal in the noise" skill IR work depends on.
  • Simplified YARA Rule Tester — Test a small set of required strings against sample content and see whether your rule matches.
  • Log Analysis / IR Lab — A messy auth.log dump from a compromised box. Reconstruct the timeline and find the breach — blue-team skills, not exploitation.
  • Secure Code Review Toy — Paste a code snippet and get flagged patterns — eval, string-built SQL, hardcoded secrets. Not a real SAST tool, but trains the eye.

Browse all 32 security tools →