Incidentally, this regex has some extra bits which might be making it a bit more confusing than it needs to be ...
for instance ((https?:)\/\/) is functionally no different than https?:\/\/ because the parenthesis are not being used as backreferences... > WOA! I think I got it... > str = rereplace(str, > "((((https?:)\/\/)|(www\.|ftp\.))[-[:alnum:]\?%,\.\/&##!@: > =\+~_]+[A-Za-z0-9\ > /])(?!((?!\[img\]).)*?\[/img\])", "<a href=""\1"" > target=""_blank"">\1</a>", > "ALL"); > now lets see if I can break it! > -----Original Message----- > From: Ewok [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 09, 2005 6:15 PM > To: CF-Talk > Subject: weee regex > These large regular expressions drive me nuts! > I've got this regex (can�t remember where but I definitely > didn�t write it. > str = rereplace(str, > "((((https?:)\/\/)|(www\.|ftp\.))[-[:alnum:]\?%,\.\/&##!@: > =\+~_]+[A-Za-z0-9\ > /])", "<a href=""\1"" target=""_blank"">\1</a>", "ALL"); > It works well. It will replace anything that matches the > form of a url with > the appropriate html to make it active and open in a new > window. > My problem is that I don�t want it to replace links that > fall between [img] > and [/img] tags > eg I would want this link skipped > [img]http://www.google.com/logos/lunarnewyear05.gif[/img] > I plan to turn the image links into <a <img tags to have > them displayed and > linked rather than just linked > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 265.8.6 - Release Date: > 2/7/2005 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194004 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

