Previous Thread
Next Thread
Print Thread
Hop To
#43739 01/08/2005 9:33 AM
Joined: Apr 2004
Posts: 7
M
stranger
stranger
M Offline
Joined: Apr 2004
Posts: 7
Hi!

Website: http://www.saabklubben.com/ubbthreads/ubbthreads.php
Version: 6.5

When I post a link at my website with commas embedded in the URL, the link gets cut off.
Example: http://www.aftonbladet.se/vss/nyheter/story/0,2789,586021,00.html

Any settings I may have missed? Is it a bug?

Joined: Jun 2006
Posts: 182
A
member
member
A Offline
Joined: Jun 2006
Posts: 182

Joined: Dec 2003
Posts: 611
Former Developer
Former Developer
Joined: Dec 2003
Posts: 611
This is currently the designed behavior for UBB.threads.

The alternative is including punctuation at the end of URLs, such as in this fake demonstration:

https://www.ubbcentral.com/boards/showflat.php/Cat/0/Number/40841.

That's the behavior in UBB.classic.

Neither is really right. I have tried and failed many times to create a regex that will grab a URL with punctuation in it, but then exclude any at the very, very end...


Charles Capps
Former UBB.classic Maintainer
Joined: Oct 2004
Posts: 5
Y
stranger
stranger
Y Offline
Joined: Oct 2004
Posts: 5
Ummm, what's wrong with this one?

(((ftps?|https?)://)*(www\.)[^ \t\n<]*([:alnum:]|#))

Joined: Dec 2003
Posts: 611
Former Developer
Former Developer
Joined: Dec 2003
Posts: 611
That does not even address the issue, really. We also use preg_, not the ereg functions.


Charles Capps
Former UBB.classic Maintainer
#43744 01/12/2005 10:20 PM
Joined: Jan 2005
Posts: 3
Y
stranger
stranger
Y Offline
Joined: Jan 2005
Posts: 3
I'm aware of how UBBT parses URLs thanks. It shouldn't matter if you use ereg or preg, they both accept Perl-compatible regular expressions. Obviously [:alnum:] won't work but that's just shorthand for [A-Za-z0-9]. Not to do your job for you or anything but here you go. Excuse me if it's not perfect, I threw it together in 5 minutes but it clearly demonstrates that this is possible:

Code
$string = "Check out this link: http://www.someurl.com/i,have,commas.html.";
$pattern = "/(((ftps?|https?):\/\/)*(www\.)[^ \t\n&lt;]*([A-Za-z0-9]|#))/i";
$replacement = "&lt;a href=\"$1\"&gt;$1&lt;/a&gt;";
echo preg_replace($pattern, $replacement, $string);

Now am I going to get banned again for my trouble or what?


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Version 7.7.5 Images suddenly not displaying
by Stovebolt - 05/04/2024 11:19 AM
Bots
by Outdoorking - 04/13/2024 5:08 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
Who's Online Now
2 members (Ruben, Gizmo), 885 guests, and 147 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)