PHP preg_match() Function

preg_match(pattern, subject, [, matches [, flags [, offset]]]) — This PHP function performs a regular expression match. This looks at the subject for a specified pattern. If a match is found, a 1 (true) is returned. Otherwise a 0 (false) is returned.

Try it here. Enter your string below to see the function in action:
Your pattern:

Your subject string:
See below for examples.

Function Result
Pattern String:
Subject String:
preg_match Result:
No Match.

Some Examples
Pattern String Subject String preg_match Result
/An apple is red/ apple A match.
An apple is red/ apple Error. Missing forward slash (/) at the beginning of the pattern.
/An apple is red/ APPLE No match. preg_match is case sensitive.
/An apple is red/i APPLE A match. Add the letter "i" to the end of the pattern string to perform a case-insensitive match.
/Foo/i FOO A match.
/you s[a|4]ve/i you save A match.
/Luxury (?:shopping|timepiece)/i luxury No match.
/Luxury (?:shopping|timepiece)/i luxury timepieces A match.
/% OFF ALL (?:designer|luxury) /i Special 80% off all designer item A match.
/% OFF ALL (?:designer|luxury) /i 10% OFF all luxury watches A match.
/R[o|0]lex (?:w[a|4]tch|timepiece)/i r0lex watch A match.
/R[o|0]lex (?:w[a|4]tch|timepiece)/i Tag Heuer watch No match.
/R[o|0]lex (?:w[a|4]tch|timepiece)/i cheap rolex timepieces A match.