Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - who understands objRegExp?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

who understands objRegExp?

 Post Reply Post Reply
Author
vicky_c View Drop Down
Newbie
Newbie


Joined: 14 March 2003
Location: Scotland
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote vicky_c Quote  Post ReplyReply Direct Link To This Post Topic: who understands objRegExp?
    Posted: 09 April 2003 at 9:33am

Hope someone can help....

I have recently set up a log in thingy to my website as part of a project and on the join up form have used objRegExp in the validation for the user inputted e-mail address (a recomendation from one of you lovely lot!) and its working great! so thanks a lot! <img border=0 onclick="AddSmileyIcon('smileys/smiley4.gif')" src="http://forums.webwiz.net/smileys/smiley4.gif" style="CURSOR: hand">

Only thing is, I need to write an alogorithm for this particular part of the coding and fully refine it.  So, does anyone who completly understands the objRegExp thingy know how to write an algorithm for these few lines? <img border=0 onclick="AddSmileyIcon('smileys/smiley5.gif')" src="http://forums.webwiz.net/smileys/smiley5.gif" style="CURSOR: hand">

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CheckMail(Email)

Function CheckMail(Email)
Dim objRegExp , blnValid
Set objRegExp = New RegExp
objRegExp.Pattern = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
blnValid = objRegExp.Test(Email)
If NOT blnValid THEN Response.Redirect "invalid.asp"
End Function

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It may seem like a stupid question but I really don't wanna mess this up!  The algorithm is worth a lot of marks and it needs to be perfect! My whole life depends on it! literally! i need to pass this subject to get into Uni!! lol!

So please help....I'm so grateful!!!!!!

Loadsa love and bubbles,
Vicky <img border=0 onclick="AddSmileyIcon('smileys/smiley1.gif')" src="http://forums.webwiz.net/smileys/smiley1.gif" style="CURSOR: hand"> xxx

Back to Top
glypher View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 25 March 2003
Location: United States
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote glypher Quote  Post ReplyReply Direct Link To This Post Posted: 09 April 2003 at 12:51pm

code is fine, but personally i wouldn't stick the redirect in the validation code.

for example:

if the function was named IsValidEmail(), the function could return a true or false.  and based on that you could decide to redirect.

==================================

Email = "ThisIsATest@myhome.com"

response.write email & " is "

if IsValidEmail(Email) then
response.write "Valid"
else
response.write "Invalid"
end if

Function IsValidEmail(Email)
  Dim objRegExp , blnValid
  Set objRegExp = New RegExp
  objRegExp.Pattern = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
  IsValidEmail = objRegExp.Test(Email)
End Function

==============================

glypher said so.

GainesvilleBands.com
Back to Top
vicky_c View Drop Down
Newbie
Newbie


Joined: 14 March 2003
Location: Scotland
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote vicky_c Quote  Post ReplyReply Direct Link To This Post Posted: 09 April 2003 at 12:54pm

Oh...em ok thanks!

Any idea how I could write the algorithm?

Back to Top
glypher View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 25 March 2003
Location: United States
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote glypher Quote  Post ReplyReply Direct Link To This Post Posted: 09 April 2003 at 1:39pm

what do you mean by "write the algorithm?"

glypher said so.

GainesvilleBands.com
Back to Top
Coco Brown View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2002
Location: United States
Status: Offline
Points: 245
Post Options Post Options   Thanks (0) Thanks(0)   Quote Coco Brown Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2003 at 12:38pm

I would advise against validating an email to see if it is the correct format.  Even with a regex pattern.

I thought I had the perfect regex for email, but kept getting burned because someone outside my country of origin would show up with some email format I hadn't accounted for.

One day, I decided to get the penultimate regex for email.  I followed it to a Perl site that had this very famous pattern created by a CS professor from MIT.  He said it was foolproof.  The regex was about 800 lines long and took 3 hours to execute.  The point that this professor was trying to make is that there is only a very, very loose protocol defining how an email address should be formatted, so validating for proper format for an email is pointless.  There is no real algorithm for doing the job.  If you absolutely must know if an email is valid, the best practice is still to send a confirmation email to the address.  

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.