As the title says I want my pattern to match the URL's in the string, except the ones that are between the BBCode tags.
So far I have made a pattern that doesn't match the URL's between the [img]
tags, but have no enough regex skills to make it work for all tags like the more advanced onces ([url=xxx]yyy[/url]
and such). So to be clear: nothing between [
and ]
should match.
Here is my working example to not match the URL's between the [img] tag:
http://regexr.com/v1?38mae (may have to paste the below pattern due to encoding being messed up)
Pattern:
(?<!\[img])(((http|ftp|https):\/\/)|www\.)[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#!]*[\w\-\@?^=%&/~\+#])
I'd appreciate any kind of help!