Urls?

Posted by Faux on Thu 13 Jan 2005 12:58 PM — 8 posts, 41,701 views.

United Kingdom #0
[[url]]http://google.co.uk/[[/url]]
[url]http://google.co.uk/[/url]

Noe =(
Amended on Thu 13 Jan 2005 12:59 PM by Faux
USA #1
Yeah someone asked about this a couple years ago I think. I believe Nick said he decided not to create a URL forum code because of fears that it could be exploited or abused by users.
USA #2
Although as an administrator you can insert URLs (and pictures, and anything else you want) into your posts.

Nick talks about it here:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=2840
United Kingdom #3
Simply to avoid boosting an old thread..


What'd be wrong with something like..?

http://faux.servebeer.com/t/bbcode2html.php
USA #4
Quote:
At present, it simply does a "replace all" of "[b]" to "<b>" and so on.
Instead of replace all of [b] to <b>, you could do replace all of [a]...[/a] to <a href="...">...</a>. Unless, of course, Nick meant that he does only one linear scan of the message, instead of uses multiple regular expressions on it.
Australia Forum Administrator #5
It is done with a linear scan. It is hard to get regexps right, because of the nesting problem.
USA #6
You could use non-greedy regexes, but I agree that the linear scan is certainly faster.

To get the link working, you'd have to keep track of where you found the open-link, then as soon as you find a close-link you'll have to do some fancy replacing. It'd be nice to have but I agree the copy/pasting isn't too bad.
USA #7
I dont mind the copy and pasting, but if you really wanted to you could probably just grab phpBB's code since I believe they allow you to do it.