PHP program to demonstrate the quantifiers in pattern to search a string using a regular expression
<?php
//PHP program to demonstrate the quantifiers in
//pattern to search a string using a regular expression.
$str = "There are five bananas in the bucket";
$pattern = "/ba(na){2}/i";
if (preg_match($pattern, $str) == 1)
printf("Found");
else
printf("Not Found");
?>
Output
Found
