Skip to main content
ToolsHub

Regex Tester

Write your regex pattern, paste test text, and see matches highlighted instantly. Supports flags, capture groups, and replace mode.

Files never leave your browser
//g

How to use Regex Tester

The Regex Tester lets you write, test and debug regular expressions interactively against live sample text. It highlights all matches in real time, displays captured groups in a structured table and supports common regex flags such as global, case-insensitive, multiline and dotAll — making it an essential tool for validating patterns before embedding them in code.

  1. Enter your regular expression in the pattern field (without surrounding slashes).
  2. Select the flags you need: g (global), i (case-insensitive), m (multiline), s (dotAll).
  3. Type or paste your test string in the input area.
  4. Matches are highlighted inline and listed in the matches panel below.
  5. Expand any match row to inspect individual capture groups and their positions.
  6. Copy the working regex (with flags) to use directly in your code.

Your data never leaves your device — 100% private processing.

Understanding regex flags

Flags modify how the regex engine processes the pattern. The global flag (g) finds all matches rather than stopping at the first. The case-insensitive flag (i) makes letter comparisons ignore case. The multiline flag (m) makes ^ and $ match the start and end of each line instead of the entire string. The dotAll flag (s) makes the dot metacharacter match newline characters, which it normally excludes. Combining flags gives fine-grained control over matching behaviour.

Capture groups and named captures

Parentheses create capturing groups that extract sub-matches. For example, (d{4})-(d{2})-(d{2}) captures year, month and day from an ISO date string into groups 1, 2 and 3. Named captures (?<year>d{4}) assign a label, making patterns self-documenting. Non-capturing groups (?:...) group tokens without creating a capture, which improves performance and keeps group numbering clean.

Common regex syntax reference
TokenMeaningExample
.Any character except newlinea.c → "abc", "a1c"
\dDigit [0-9]\d{3} → "123"
\wWord character [A-Za-z0-9_]\w+ → "hello_1"
^Start of string/line^Hello → "Hello world"
$End of string/lineworld$ → "Hello world"
*Zero or moreab* → "a", "ab", "abb"
+One or moreab+ → "ab", "abb"
?Zero or one (optional)colou?r → "color", "colour"

Glossary

Regex
Regular expression — a pattern that describes a set of strings using special syntax.
Lookahead
A zero-width assertion (?=...) that matches a position followed by a specific pattern without consuming characters.
Lookbehind
A zero-width assertion (?<=...) that matches a position preceded by a specific pattern.
Quantifier
A token such as *, +, ?, {n,m} that specifies how many times the preceding element may appear.
Backreference
A token \1 that matches the same text previously matched by capture group 1.

Related reading

Frequently Asked Questions

Free · No spam

Get weekly tool tips & updates

New tools, power-user tips, and productivity hacks — delivered free every Friday.

No spam, ever. Unsubscribe with one click.

Why use Regex Tester?

  • No installation — use directly from any browser
  • Handles large inputs without crashing or timeouts
  • Syntax highlighting and formatted output for readability
  • Copy to clipboard shortcut for fast workflow integration

Common use cases

  • Validate and format JSON responses from APIs
  • Encode/decode Base64 strings during debugging
  • Generate UUIDs for database seeds or test data
  • Minify CSS or JavaScript before deployment
  • Diff two code snippets to spot regressions

Related Developer Tools

Explore all Developer Tools.