Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Help with some code...
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

anderzzo
Starting Member

5 Posts

Posted - 21 May 2001 :  20:45:06  Show Profile  Visit anderzzo's Homepage
I got this code for "automatic" links
but if you write a "-" or a "~" the link
stops there, can anyone help me fix this?

 <script language="javascript1.2" runat=server>
function edit_hrefs(s_html){
// use regular expressions to look for
// e_mail addresses and urls
s_str = new String(s_html);

s_str = s_str.replace(/\bhttp\:\/\/www(\.[\w+\.\:\/\_]+)/gi,
"http\:\/\/¬¤¸$1");

s_str = s_str.replace(/\b(http\:\/\/\w+\.[\w+\.\:\/\_]+)/gi,
"<a href=\"$1\">$1<\/a>");

s_str = s_str.replace(/\b(www\.[\w+\.\:\/\_]+)/gi,
"<a href=\"http://$1\">$1</a>");

s_str = s_str.replace(/\bhttp\:\/\/¬¤¸(\.[\w+\.\:\/\_]+)/gi,
"<a href=\"http\:\/\/www$1\">http\:\/\/www$1</a>");

s_str = s_str.replace(/\b(\w+@[\w+\.?]*)/gi,
"<a href=\"mailto\:$1\">$1</a>");


return s_str;
}
</script>


[url=http://www.data-doktorn.nu]-=Data-Doktorn=-[/url]
Snart på en dator nära dig!

gor
Retired Admin

Netherlands
5511 Posts

Posted - 22 May 2001 :  02:45:49  Show Profile  Visit gor's Homepage
Take a look at the edit_hrefs() function in inc_functions.asp of the forum.
It is the last function in the file.
Looks almost the same, but with a lot more allowed characters.

Pierre
Join the Snitz WebRing
Go to Top of Page

anderzzo
Starting Member

5 Posts

Posted - 22 May 2001 :  04:01:45  Show Profile  Visit anderzzo's Homepage
Thankz!

[url=http://www.data-doktorn.nu]-=Data-Doktorn=-[/url]
Snart på en dator nära dig!
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 22 May 2001 :  04:36:41  Show Profile  Visit gor's Homepage
You're welcome

btw,

try this:

[ url="http://www.data-doktorn.nu" ]-=Data-Doktorn=-[ /url ]

without the extra spaces, but with the 2 ", and it will produce this:
-=Data-Doktorn=-

Pierre
Join the Snitz WebRing
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07