I need a regex that looks for any URL that isn't already inside [url(=...)]...[/url] tags. In other words, I want to link any URL that isn't linked and replace the link with [url]link[/url] so that the parser I'm using can take care of it as it usually would.

I've been trying to get an understanding of negative lookaheads (which is apparently what I should make use of), but I just can't get it down.

This is what I've got so far:

```
preg_replace('/(?!\[url(=.*?)?\])(https?|ftps?|irc):\/\/(www\.)?(\w+(:\w+)?@)?[a-z0-9-]+(\.[a-z0-9-])*.*(?!\[\/url\])/i',"[url]$0[/url]",$Str);

```

Thanks