Regex tester

Test a regular expression against your own text and see every match and group.

#1 at position 7
00-950
#2 at position 22
30-001

Last updated: October 2026 · Report a calculation error

How to test a regular expression

Enter a regex and some text — the tester instantly shows every match with its position and capture groups. It uses the JavaScript engine (RegExp), so results match browsers, Node.js and TypeScript.

Example: \b\d{2}-\d{3}\b finds Polish postcodes. In “Warsaw 00-950, Kraków 30-001, phone 123-456-789” it matches 00-950 and 30-001 and skips parts of the phone number thanks to the word boundaries \b.

Syntax essentials

PatternMeaning
\d, \w, \sdigit, word character, whitespace
.any character (except newline, unless flag s)
*, +, ?0 or more, 1 or more, 0 or 1
{2}, {2,4}exactly 2, from 2 to 4
[a-z], [^0-9]character range, anything except digits
^, $start and end of text (or line with flag m)
( ), (?: )capturing and non-capturing group
a|ba or b

Flags

  • i — case-insensitive.
  • m — ^ and $ match the start and end of each line.
  • s — dot matches newlines too.
  • u — Unicode mode: correct handling of emoji and classes like \p{L} (any letter in any alphabet).

Frequently asked questions

How do I match accented letters?

[a-z] doesn’t include them. With the u flag, use \p{L}, which matches any letter in any alphabet.

Why does my regex work here but not in PHP or Python?

The syntax is similar but not identical — named groups, lookbehind and Unicode classes differ between engines. This tester uses the JavaScript engine.

See alsoWhole category

  1. IT-01Base64 encoder and decoderEncode text to Base64 or decode a Base64 string back to text.
  2. IT-02JSON formatter and validatorBeautify or minify JSON, check that it is valid and see exactly where a syntax error is.
  3. IT-03HEX / RGB / HSL color converterConvert colors between HEX, RGB and HSL with a live preview.
  4. IT-04SHA-256 hash generatorGenerate SHA-256, SHA-1 and SHA-512 hashes of any text.