Search and replace using regular expression in PHP using preg_replace function. It is very powerful way to search and replace. I suggest using some online regular expression tool to test out your patterns.
Source code viewer
/** * In regular expressions parentheses are used to determinate subpatterns. * Subpattern results are put to variables such as $1, $2, etc. */Programming Language: PHP