From: "Jochem Maas" <[EMAIL PROTECTED]> > alternatively (actually this looks like the easier way to do it!) use > preg_replace(), with the 'e' modifier tagged onto the end of the > replacement expression: the 'e' modifier causes the expression to be > evaluated as PHP. > > http://nl2.php.net/manual/en/function.preg-replace.php > http://nl2.php.net/manual/en/pcre.pattern.modifiers.php > > something like: > > $pattern = '/\[link="([[:graph:]]+)"]/'; > $replacement = "/check_this_out('\1')/e"; > $output = preg_replace($pattern, $replacement, $output);
Good idea, except the "e" modifier goes in the pattern, not the replacement. And you don't need delimiters in the replacement. $pattern = '/\[link="([[:graph:]]+)"]/e'; $replacement = "check_this_out('\1')"; $output = preg_replace($pattern, $replacement, $output); ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php