I am such a regex noob it is not even funny. I have found this function to covert BBcode to HTML, but I found a problem.
If I do this, then it makes the URL like it should and puts the words 'Other Text' after the link like you would exprect.If I do this, the 2 links get merged together.Code:[ url=http://blah.com]balh[/url] Other Text '<a href="http://blah.com target="_blank">blah</a> Other text"Here is my code to do the regex stuffCode:[ url=http://blah.com]balh[/url] Other Text [ url=http://blah2.com]blah2[/url] '<a href="http://blah.com" target="_blank">balh[/url] Other text [ url=http://blah2.com]blah2</a>
**edit, I had to add the space between [ and url because vbforums was making it a linkPHP Code:$texte = preg_replace('/\[url=(.+?)\](.+)\[\/url\]/i','<a href="\\1" target="_blank">\\2</a>',$texte);
Crap, it messes up my preg_replace stuff too.





I drink to make other people more interesting!
Reply With Quote