In preg_replace case need's to be done like this: $s = preg_replace('/(\<.*\>)/Uem', 'strtolower("$1")', $s);