Author |
Topic |
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 24 September 2003 : 00:26:45
|
this is sort of a continuation of the discussion here:
http://forum.snitz.com/forum/topic.asp?TOPIC_ID=41318
How does everyone feel about scraping the current Javascript Regex/VBScript functions that are used to convert URLs to clickable URLs automatically and using VBScript's RegEx function?
I for one, would love to have 1 function that could handle all URLs... |
|
dayve
Forum Moderator
USA
5820 Posts |
Posted - 24 September 2003 : 00:43:04
|
I'm all for it, but one thing I would ask is since Regex would be executed on the server side, would that be an unnecessary hit to the server whereas the JavaScript function is handled on the client side? |
|
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 24 September 2003 : 03:47:49
|
We will need to keep the existing functions in the code though, as you will still find some servers do not support it |
|
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 24 September 2003 : 05:06:03
|
I'll put my vote in for RegEx.
Im not aware of any resource issues with RegEx's in fact it's a rather efficient way of doing many things that would otherwise take several lines of code. |
Kiwihosting.Net - The Forum Hosting Specialists
|
Edited by - Gremlin on 24 September 2003 05:06:27 |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 24 September 2003 : 06:46:02
|
quote: Originally posted by dayve
I'm all for it, but one thing I would ask is since Regex would be executed on the server side, would that be an unnecessary hit to the server whereas the JavaScript function is handled on the client side?
The current edit_hrefs javascript function is run on the server, not client side:
<script language="javascript1.2" runat="server"> |
|
|
davemaxwell
Access 2000 Support Moderator
USA
3020 Posts |
Posted - 24 September 2003 : 07:56:26
|
quote: Originally posted by HuwR
We will need to keep the existing functions in the code though, as you will still find some servers do not support it
I thought that all the servers from IIS4 on supported regex. I can't imagine too many servers still running IIS3 (I even think some of the service packs added the functionality in - or am I just confused like usual?)
I would vote for using regex. I have found its use to make things run much more efficiently. You could probably even find an already existing pattern over at regexlib.com. |
Dave Maxwell Barbershop Harmony Freak |
|
|
dayve
Forum Moderator
USA
5820 Posts |
Posted - 24 September 2003 : 10:27:41
|
quote: Originally posted by RichardKinser
quote: Originally posted by dayve
I'm all for it, but one thing I would ask is since Regex would be executed on the server side, would that be an unnecessary hit to the server whereas the JavaScript function is handled on the client side?
The current edit_hrefs javascript function is run on the server, not client side:
<script language="javascript1.2" runat="server">
DOH! how the heck did I miss that? |
|
|
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
|
Davio
Development Team Member
Jamaica
12217 Posts |
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 24 September 2003 : 14:13:41
|
What is the advantage? I mean, were still doing regex's one way or the other, and we'd still need similar regex expressions. The main advantage I see is eliminating a second server scripting language, which is probably worth the recoding in itself.
Am I missing something magical the vb regex object will provide over the js regex? Is there any performance data comparing the vbs regex vs. js regex? I'm no regex wiz myself :) |
====== Doug G ====== Computer history and help at www.dougscode.com |
Edited by - Doug G on 24 September 2003 17:27:42 |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 24 September 2003 : 14:16:39
|
quote: Originally posted by davemaxwell
quote: Originally posted by HuwR
We will need to keep the existing functions in the code though, as you will still find some servers do not support it
I thought that all the servers from IIS4 on supported regex. I can't imagine too many servers still running IIS3 (I even think some of the service packs added the functionality in - or am I just confused like usual?)
I would vote for using regex. I have found its use to make things run much more efficiently. You could probably even find an already existing pattern over at regexlib.com.
The use of regex is not dependant on the version of IIS that is running, it depends on the version of the vbscript engine. I know for a fact that people will have problems, as I have already tried using regex in the forum code before to do the bad word filtering, but had numerous complaints from users whose server did not support the function. |
|
|
Podge
Support Moderator
Ireland
3775 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 24 September 2003 : 20:39:43
|
quote: Originally posted by Doug G
What is the advantage? I mean, were still doing regex's one way or the other, and we'd still need similar regex expressions. The main advantage I see is eliminating a second server scripting language, which is probably worth the recoding in itself.
Am I missing something magical the vb regex object will provide over the js regex? Is there any performance data comparing the vbs regex vs. js regex? I'm no regex wiz myself :)
I find Regular Expressions in vbScript easier to understand. I have never been able to find a reference regarding Regular Express in javascript. Most likely the current Javascript Regular Expressions that we are using could be tweaked.
for example, in regards to the trailing . or , the following vbscript function I found handles those:function LinkURLs(tempTxt)
Dim regEx
Set regEx = New RegExp
regEx.Global = True
regEx.IgnoreCase = True
'Hyperlink Email Addresses
regEx.Pattern = "([_.a-z0-9-]+@[_.a-z0-9-]+\.[a-z]{2,3})"
tempTxt = regEx.Replace(tempTxt, "<a href=""mailto:$1"">$1</a>")
'Hyperlink URL's
regEx.Pattern = "((www\.|(http|https|ftp|news|file)+\:\/\/)[_.a-z0-9-]+\.[a-z0-9\/_:@=.+?,##%&~-]*[^.|\'|\# |!|\(|?|,| |>|<|;|\)])"
tempTxt = regEx.Replace(tempTxt, "<a href=""$1"">$1</a>")
'Make <a href="www = <a href="http://www
tempTxt = Replace(tempTxt, "href=""www", "href=""http://www")
LinkURLs = tempTxt
end function also, notice in the code example above that:
http://www
has been converted to a clickable link, even though it is not a valid URL, that is something that I think we need to work on.
It just seems that we could do alot more if we used vbscript Regular Expressions. I may be wrong, that's just the way it seems to me. |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
Topic |
|