Regular Expression Tester

Designed for testing PHP preg_replace/preg_filter RegEx patterns, but good for any PCRE application.

For a JavaScript RegExp tester, try http://regexpal.com/

Click here for: PHP PCRE regex syntax Manual pages

Or here for: RegEx Cheat Sheet

Inputs:


   
preg_replace()
preg_filter()
preg_split()






Hint: Use $n where 'n' = 1, 2, 3, ... to access parenthesized matches [e.g. $1$2 $3]. The resultant string will appear in the "Formatted Text:" box if the Pattern produces one or more matches.
Example:
    Target Text: "One foo too many" [All check boxes unchecked]
    Pattern: "^([A-Z][a-z]+)\s[fo]{3,3}\s([a-z]+)\s([a-z]+).*$"
    Replacement: "$1 $2 $3"
    Formatted Text: "One too many"

Output:

# of Replacements: 0


Error: