zacdaddytools

Regex Tester

Test JavaScript regular expressions, flags and matches as you type.

Pattern and flags

Enter a JavaScript regex pattern without / delimiters.

Processed locally in your browser

/g
Regular expression flags

0 / 100,000 characters

Enter a pattern

Results update as you edit the pattern, flags or text.

Match preview

Matches are marked and also listed with their positions.

Test text will appear here.

Test JavaScript regular expressions

A regular expression, often shortened to regex, is a pattern for finding text. Enter the pattern itself without surrounding slash delimiters, choose the flags you need and paste test text. Matches update as the pattern, flags or text changes.

This tool uses the regular-expression engine built into JavaScript in your browser. JavaScript regex syntax and behaviour can differ from PCRE, Python, .NET, Java and PHP, so test a pattern in its destination language before relying on it there.

Find the whole word “cat”

Pattern: \bcat\b with the global (g) flag.

Text: The cat sat down. A category is not a cat.

Result: two matches; “category” is excluded by the word boundaries.

Patterns, flags and match positions

Character classes describe sets of characters: \d matches a digit and \w matches a JavaScript word character. Quantifiers control repetition, so \d+ finds one or more consecutive digits. The anchors ^ and $ refer to the beginning and end; with multiline mode they can also apply to individual lines.

Global (g) returns every match instead of the first. Ignore case (i) matches letter case variations, multiline (m) changes line-anchor behaviour, dotAll (s) lets a dot include line breaks, and Unicode (u) enables Unicode-aware parsing. Groups in parentheses can capture parts of a match, while a backslash escapes characters that would otherwise have special meaning.

  • Use character classes such as [A-Z] when you need an explicit set or range.
  • Check quantifiers such as *, + and ? carefully because they change how much text can match.
  • Escape a literal dot as \. because an unescaped dot normally matches almost any character.

Read results and errors safely

The preview marks matched text and the result list provides match numbers and zero-based indexes, so the result does not depend on colour alone. Invalid syntax is caught and shown as a concise browser-provided message instead of crashing the page.

Some patterns can take a long time on particular input because of excessive backtracking. The tool limits pattern and test-text size and avoids unnecessary repeated loops, but it is not a separate security sandbox. Start with representative text and review complex expressions before using them with untrusted or very large input.

Your pattern and test text are processed locally in your browser and are not sent to Zacdaddy. The tool does not require an account or an external regex service.

FAQs

Questions about the regex tester

What is a regular expression?

A regular expression is a compact pattern used to find, validate or split text. Its exact syntax depends on the regex engine being used.

Which regex engine does this tool use?

It uses your browser’s JavaScript RegExp implementation. Patterns may behave differently in PCRE, Python, .NET, Java, PHP or other engines.

What do the g and i flags do?

The g flag finds every match rather than stopping after the first. The i flag makes matching case-insensitive.

Why is my regex invalid?

Typical causes include an unclosed group or character class, an incomplete escape, an invalid quantifier or syntax unsupported by the JavaScript regex engine.

Is my test text uploaded anywhere?

No external testing API is used. The pattern matching runs locally in your browser.