ToolPalace

Regex Tester

Developer

Test and debug regular expressions live with match highlights.

//g

Common Patterns

How to use Regex Tester

  1. 1Enter your regular expression pattern in the Pattern field (no forward slashes needed).
  2. 2Select flags as needed: g (find all matches), i (ignore case), m (multiline).
  3. 3Type or paste your test string in the Test String area.
  4. 4Matches are highlighted in real time — yellow for full matches, coloured for capture groups.
  5. 5Review the match list below to inspect individual matches and captured groups.

Frequently Asked Questions

About Regex Tester

Regular expressions are one of the most powerful tools in a developer's toolkit — and one of the most misunderstood. A well-crafted regex can replace 50 lines of string-parsing code with a single pattern. Regex is used for form validation (email, phone, passwords), search and replace in code editors, log parsing, data extraction from HTML/text, and routing in web frameworks.

The best way to learn regex is to test patterns interactively. Writing a regex blind and hoping it works leads to bugs that are hard to diagnose. Using a live tester like this one lets you see exactly what your pattern matches, which groups capture which text, and how flags change behaviour — all in real time as you type. Building regex iteratively this way is the professional workflow.

Common regex pitfalls: (1) Forgetting the global flag g — without it, only the first match is found. (2) Not anchoring patterns — /\d+/ matches any digits anywhere in the string; /^\d+$/ ensures the entire string is digits. (3) Greedy vs lazy matching — .* grabs everything; .*? stops at the earliest match. (4) Special characters in user input — always escape user-provided strings before using them in a dynamic regex. (5) Catastrophic backtracking — nested quantifiers like (a+)+ can cause exponential slowdowns on non-matching strings.

JavaScript regex has improved significantly in recent versions. ES2018 added lookbehind assertions (?<=...) and (?<!...), named capture groups (?<name>...), and the dotAll s flag. ES2020 added the String.matchAll() method for iterating all matches with their groups. ES2024 adds the v (unicodeSets) flag for improved Unicode support. This tool supports all ES2020+ features available in modern Chrome, Firefox, and Safari.

You might also like