Regex tester and replacer

Pattern library

Highlighted matches

Matches ()

Replacement result


    

Examples

Pattern

\d{4}-\d{2}-\d{2}

Matches in 2026-06-03

2026-06-03

Regex Guides & articles

Related tools

Regex tester: test a regular expression online is often used together with JSON formatter, validator and beautifier online, URL decoder and URL encoder online, Time zone converter, current time in UTC and Unix timestamp converter when payloads, tokens, URLs, logs, or markup move through the same workflow.

Regex tester and replacer

Test expressions, flags, matches and replacement output live. DevToolGrid Online offers a free Regex tester: test a regular expression online.

What is a regular expression?

A regular expression (regex) is a pattern that describes a set of strings. Developers use regex to search text, validate input such as emails or dates, extract parts of a string, and find-and-replace with precision. A pattern is built from literal characters plus metacharacters like ., *, +, ? and character classes.

How to test a regular expression

  1. 1 Type your pattern in the pattern field.
  2. 2 Toggle flags such as g (global), i (ignore case) and m (multiline).
  3. 3 Enter sample text; matches are highlighted and listed with their groups.
  4. 4 Add a replacement using $1, $2 or named groups to rewrite the text.

Common regex pitfalls

  • Unescaped special charactersCharacters like . * + ? ( ) [ ] have special meaning. To match them literally, escape them with a backslash.
  • Greedy vs lazy quantifiers* and + are greedy and match as much as possible. Add ? (for example .*?) to match as little as possible.
  • Forgetting the global flagWithout the g flag only the first match is replaced or returned.

Test regex in code

Regex tester JS

new RegExp(pattern, flags).test(input)

Regex match Python

re.search(pattern, text)

Regex tester Java

Pattern.compile(p).matcher(s).find()

Regex match C#

Regex.IsMatch(input, pattern)

Regex tester PHP

preg_match($pattern, $subject, $m)

Regex match bash

[[ $s =~ $re ]]

Regex tester PowerShell

$s -match $pattern

Regex groups Python

re.search(p, s).group("name")

Regex flags js

/pattern/gimsu

Regex tester vs replacer

A regex tester checks whether a pattern matches and shows every match and capture group — ideal for validation and debugging. A regex replacer rewrites text by substituting matches with a replacement string that can reference captured groups via $1 or $<name>. This tool combines both, plus a split mode and a library of ready-made patterns.

FAQ

Is this tool free?

Yes. The regex tester and replacer are completely free with no limits.

Do I need a regex tester download?

No. This regex tester online runs in the browser, so a regex matcher and a regex match checker are available without installing anything.

Can I test regex replace here?

Yes. Enter a pattern and a replacement to test regex replace before running it on real data, and use it as a regex match checker for a plain yes or no answer.

Is my text sent to a server?

No. Patterns and test text are evaluated locally in your browser; nothing is uploaded.

Which regex flavor does it use?

It uses the JavaScript (ECMAScript) regex engine, including named groups and the s and u flags.

Does it support capture groups?

Yes. Numbered and named groups are shown for every match and can be used in replacements.