$re = '/all/m';
$str = 'A regex with the character pattern "all", will match each occurrences of the letter a followed by two l letters in a text. This means it will find matches for all, hallway, ballon and fall.
The two l:s, needs to come after the letter a, so it will not match dollar or pillar. The regex also expects two l:s, one isn\'t enough. It will not find any match in words like falcon or although. If the text contains other characters in betwen the a and the two l:s, it won\'t consider it as a match. This means it won\'t find a match in the name Al Leaong or if we misspell all life as al life.';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php