I'm trying to match on "url" BB code tag in a random piece of text. Example text:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. [url]http://www.google.com[/url] Donec purus nunc, rhoncus vitae tempus vitae, [url=www.facebook.com]facebook[/url] elementum sit amet justo.
I want to find both "url" tags from this text:
[url]http://www.google.com[/url]
[url=www.facebook.com]facebook[/url]
I am not that good with regular expressions so this is as far as I could get:
\[url(=[a-z]*)?\][a-z]*\[/url\]
I think I just need to replace [a-z] with something that matches on anything EXCEPT the characters '[' and ']'. Can anybody help me out with this please?