I want to match all occurrences for pony word, except in these situations:
- [url=pony.com]pony[/url]
- [url]pony.com[/url]
In synthesis, the matches should be:
pony en pony [url=pony.com]pony[/url], también tengo que pony [url=pony.com]pony[url], y no olvidar a [url]pony.com[/url]
To accomplish the goal, I have created this regex:
(?!\[url[^\]]*?\])(pony)(?![^\[]*?\[\/url\])
However, for some some reason, the matches are the following:
pony en pony [url=pony.com]pony[/url], también tengo que pony [url=pony.com]pony[url], y no olvidar a [url]pony.com[/url]
Why is happening this? My idea at first place it to find the correct occurrences, and then, replace them using php.