CHAPTER 9
■
PERFORMING FORM VALIDATION WITH REGULAR EXPRESSIONS
315
regexes, they will become a powerful tool for pattern matching.
TEST_DATA;
/*
* Use str_replace() to highlight
any occurrence of the word
* "regular"
*/
echo str_replace("regular", "
regular", $string);
/*
* Use preg_replace() to highlight any occurrence of the word
* "regular"
*/
echo preg_replace("/regular/", "
regular", $string);
?>
/*
* Store the sample set of text to use for the examples of regex
*/
$string = <<
Do'stlaringiz bilan baham: