Hey,
I'm using an ubb parser to convert several codes within brackets to html codes. I want to use a string replacer aswell to replace some unwanted words.
Now, I'm using this:
foreach($f AS $value) {
$escapeNamesArray[] = '/'.$value['woord'].'/i';
$escapeNamesReplace[] = '<span style="color: gray;">'.$value['vervanging'].'</span>';
}
$string = preg_replace($escapeNamesArray, $escapeNamesReplace, $string);
When I want to replace the word "Hello" to "Hey", everything is working fine. But when I place the word "Hello" between brackets, for example:
[url=http://www.hello.com]kdskdsds[/url]
The word "Hello" is replaced aswell. How can I change the pattern of the preg_replace function to ignore words between brackets?
Thanks for your reply!