Hi, I am having a text: $text="text text>bla1<text text>bla2<text text>bla3<"; PHP: and a function: function edit($x) { ....... ....... return $x; } PHP: What I need is to search for all texts between > and < and replace them with edit() example: replace bla1 with the result of edit("bla1") replace bla2 with the result of edit("bla2") replace bla3 with the result of edit("bla3") I know this can be done with preg_replace , but couldn't figure out exactly how. Thanks
www.php.net/preg_replace_callback Or using the e (eval) modifier: preg_replace('~>(.*?)<~se', 'edit("$1")', $text); PHP: