I got this far thanks to a post on the board already... what I am doing is adding PHPBB functionality to posts on my site. For example i'm having
Code Here
provide a small area where the code can be highlighted and displayed on the site. (like phpbuilder's [PHP ])
$replace_with = 'Code by {BY}<hr>{CODE}<hr>';
$code_pattern = '/\[CODE=(.*?)\](.*?)\[\/CODE\]/si';
$replace_with = str_replace('{BY}', '\1', $replace_with);
$replace_with = str_replace('{CODE}', '\2', $replace_with);
$text_return = preg_replace($code_pattern, $replace_with, $text_return);
My question is i'm replacing {BY} with \1 for the first match, and {CODE} with \2 for the second match which is the actual code, but is there any way to put the value of \2 onto $value_2. The reason I want to do this is so that i can use the highlight_string($value_2); to parse the php code. I may be using the wrong function altogether, but i'm very new to regular expressions/preg_replace.
Thanks.