My question involves regex/javascript code I am working with:
toReturn = toReturn.replace(/(\[url=)(.+)(\])(.+)(\[\/url\])/g, '<a target=\"_blank\" href="\$2">\$4</a>');
The issue I am encountering is that when a user enters the following text:
[url=example]example[/url]
some_other_text
[url=example2]example2[/url]
The first [url=] tag is getting incorrectly linked with the last [/url] tag resulting in only one incorrect URL!!!!!
I am seeking advice on how to resolve this problem. Any suggestions?