preg_match Online
Test PHP's preg_match() function online using real PHP 8.2. Test regular expressions against strings and see matches instantly. Perfect for debugging regex patterns.
preg_match(string $pattern, string $subject, array &$matches = null, int $flags = 0, int $offset = 0): int|false Regular Expression Pattern
Enter your regex pattern (include delimiters like /pattern/)
Subject String
Enter the text you want to match against
PHP Code
This is the actual PHP code that will be executed
Common Regex Patterns
preg_match() Function Guide
About preg_match()
This tool runs actual PHP 8.2 code on our server using Docker containers. It executes real PHP's preg_match() function, ensuring 100% accurate results. The function performs a regular expression match and returns 1 if the pattern matches, 0 if not, or false on error.
- Tests regex patterns against strings
- Captures matching groups
- Returns 1 on match, 0 on no match
- Stops after first match
- Use preg_match_all() for all matches
Common Modifiers
i- Case-insensitive matchingm- Multiline mode (^ and $ match line breaks)s- Dot matches newlinesx- Ignore whitespace in patternu- UTF-8 mode
Example: /pattern/im would be case-insensitive and multiline.
Request a Feature
Have an idea to improve this tool? Share your suggestions and help us make it better! (One request per day)

