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

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 VBScript RegEx, time to use it?
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 24 September 2003 :  00:26:45  Show Profile
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  Show Profile  Visit dayve's Homepage
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?

Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 24 September 2003 :  03:47:49  Show Profile  Visit HuwR's Homepage
We will need to keep the existing functions in the code though, as you will still find some servers do not support it
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 24 September 2003 :  04:37:57  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
quote:
I for one, would love to have 1 function that could handle all URLs...

I agree, this would be great. But how would this affect performance, and as dayve said, the server? I somehow remember hearing "resource expensive" about regular expressions.

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 24 September 2003 :  05:06:03  Show Profile  Visit Gremlin's Homepage
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
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 24 September 2003 :  06:46:02  Show Profile
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">
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 24 September 2003 :  07:56:26  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
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
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 24 September 2003 :  10:27:41  Show Profile  Visit dayve's Homepage
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?

Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 24 September 2003 :  10:37:30  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
quote:
DOH! how the heck did I miss that?
Avoid something similar in the future

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 24 September 2003 :  10:51:24  Show Profile  Visit Gremlin's Homepage
quote:
Originally posted by OneWayMule

quote:
DOH! how the heck did I miss that?
Avoid something similar in the future

ROFL Smartypants ! :)

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 24 September 2003 :  11:47:09  Show Profile
You got my vote for RegExp too.

Support Snitz Forums
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 24 September 2003 :  14:13:41  Show Profile
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
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 24 September 2003 :  14:16:39  Show Profile  Visit HuwR's Homepage
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.
Go to Top of Page

Podge
Support Moderator

Ireland
3775 Posts

Posted - 24 September 2003 :  18:32:41  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message
quote:
The use of regex is not dependant on the version of IIS that is running, it depends on the version of the vbscript engine.


True.

I remember reading that using serverside vb & javascript on the smae page caused a performance hit but I cannot seem
to remember where...

It is discussed a little here - http://p2p.wrox.com/archive/asp_forms/2002-03/42.asp


Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 24 September 2003 :  20:39:43  Show Profile
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.
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 24 September 2003 :  21:37:31  Show Profile
How about at offering an option to use vbscript reg exp?

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 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.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07