10-25-2007, 11:26 AM
|
#9 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
I've redone your regex and removed the preg_quote.
PHP Code:
function BBcode($szInput) { $aBBPattern = array( '\[b\](.*?)\[\/b\]' => '<b>\\1</b>', '\[i\](.*?)\[\/i\]' => '<i>\\1</i>', '\[url="([http:\/\/]+[^"]+)"\](.*)\[\/url\]' => '<a href="\\1">\\2</a>' );
foreach( $aBBPattern as $szKey => $szValue ) { $szPattern = '/'. $szKey .'/isU'; $szInput = preg_replace( $szPattern, $szValue, $szInput ); }
return $szInput;
}
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|