PDA

View Full Version : Parsing text URL's


Chris Gwynne
06-20-2003, 09:51 AM
I'm not much involved in vB as of late, but I still have the curious nature.

How would I be able to parse text links into proper hyperlinks. Example:

If someone typed vBulletin.com into a post rather than writing out the full URL, vB would automatically convert that text link to vBulletin.com (http://www.vbulletin.com/)

So it'd work if anyone typed in text and added a .com/.co.uk/.org etc etc after it. Of course theres the risk that the link won't work if the site doesn't exist... But still. :)

Any ideas?

Regards,
Chris

filburt1
06-20-2003, 10:41 AM
It already does this pretty much everywhere...look at the bbcodeparse2() function :)

Blindchild02
06-20-2003, 11:57 AM
couldnt u use the replacement option?

filburt1
06-20-2003, 12:05 PM
Oh, I get what you're asking now. Yes, you could use replacements but it would show the raw HTML in posts rather than a link itself.

Try finding the regular expression in bbcodeparse2() that parses links, and get rid of the protocol; it might look like (http|ftp):\/\/.