Hi,
I'm trying to create a simple BB code-type function, but I'm having trouble putting a function within preg_replace. Let me show you what I mean:
$bb_search = array
(
'/\[b\]/',
'/\[\/b\]/',
'/\[img\=(.*?)\]/',
);
$bb_replace = array
(
'<b>',
'</b>',
check_image( '\\1' ),
);
return preg_replace( $bb_search, $bb_replace, $text_string );
The first two (b and /b) work fine, even the function is recognised, but using \\1 doesn't put the bbcode value as the function value. I know that probably made no sense - I'm terrible at explaining these things, so sorry. If anyone can understand what I mean, even offer a solution, that would be great!
Cheers!