Home/Tools/PHP Regex Tester

PHP Regex Tools

PHP Regex Tester

Test regular expression patterns against sample text before using preg_match in PHP.

Matches

Match 1: user_42
Group 1: 42
Match 2: user_99
Group 1: 99

Use this regex tester for quick checks before moving a pattern into PHP preg_match() or preg_match_all().

Input format

Place the regex pattern on the first line, then place your test text below it.

PHP example

preg_match('/user_(\d+)/', 'user_42', $matches);

Common mistakes

JavaScript regex and PHP PCRE are similar for simple patterns, but not identical. Test advanced PCRE features in PHP before shipping.

FAQ

Is this exactly PCRE?

The browser version uses JavaScript regular expressions, so some PCRE features may differ.

How should I enter input?

Put the pattern on the first line and the test text on the following lines.

Related tools

Related guides