View Full Version : Resolved preg replace backreference

Phil Jackson
10-22-2009, 06:43 AM
Hello all could someone tell me, as i have never used a backreference, how to use it in this case:

$line = preg_replace("#\s*([^\(\s]*)(\s*)\(([^\)]*)\)#is", "<span class=\"function\">".$1.$2."</span>(".$3.")", $line);

Phil Jackson
10-22-2009, 06:58 AM
ah sorted it

$return = preg_replace("#\s*([^\(\s]*)(\s*)\(([^\)]*)\)#is", " <span class=\"function\">\\1\\2</span>(\\3)", $return);

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum