11/27/2024 2:23:24 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
E-Mail Validation
Posted: 02 Feb 07 10:21 AM
|
fiogf49gjkf0d Everyone, I am using the pattern matching suggested in the artical on SLXDeveloper.. However within the code I am trying to understand the actual pattern.. Here is the code
+++++++++ CODE +++++++++++ ' check the syntax of an email address (TRUE/FALSE) Function CheckEmailAddress(strEMail) Dim objRegExp, iMatches, sPattern
' search pattern of valid email address: ' valid characters are: a-z, 0-9, ., -, _ ' only one @-sign is allowed; minimum is one dot after @-sign, number of ' characters after last dot is 2 chars, maximimum is 4 chars
sPattern = "^[\w\.\-]+@([\w\-]+\.)*[\w\-]{2,63}\.[a-zA-Z]{2,4}$"
' leave function and return false when parameter is empty If len(trim(StrEMail)) = 0 Then CheckEmailAddress = False Exit Function End If
' generate new regular expression Set objRegExp = New RegExp objRegExp.Pattern = sPattern objRegExp.IgnoreCase = True Set iMatches = objRegExp.Execute(strEMail)
If iMatches.Count = 1 Then CheckEmailAddress = True Else CheckEmailAddress = False End If
Set objRegExp = Nothing End Function
++++++++ CODE ++++++++++++
My question is .. which part of the "Pattern" is responsible for the underscore charater being viewed as acceptable
Thanks for the help
Rich |
|
|
|
Re: E-Mail Validation
Posted: 02 Feb 07 10:39 AM
|
fiogf49gjkf0d In this type of regexp, the "\w" represents a "word" character, which is alphanumeric plus underscore.
Just to break it down: ^ = from the beginning of the string [\w\.\-]+ = match any "word" character, period, or dash one or more times @ = match the "@" character ([\w\-]+\.)* = match one or more "word" characters or dashes, followed by a period, any number of times (including none at all) [\w\-]{2,63} = match from two to 63 "word" characters or dashs \. = match a period [a-zA-Z]{2,4} = match 2 to 4 alphabetic characters $ = and the string should end immediately |
|
|
|
Re: E-Mail Validation
Posted: 02 Feb 07 10:44 AM
|
fiogf49gjkf0d Thanks Trevor.. Just wondering why the Underscore would be failing then... |
|
|
| |
|
Re: E-Mail Validation
Posted: 02 Feb 07 10:47 AM
|
fiogf49gjkf0d What precisely is failing (you can, of course, change the alphanumeric characters for privacy reasons)? I'd need to see a specific example to know for sure. Of course, it's always possible there's a bug in the regexp parser. |
|
|
| |
| |
|
Re: E-Mail Validation
Posted: 02 Feb 07 11:26 AM
|
fiogf49gjkf0d Ok your response prompted me to check further.. the user had cut and pasted the e-mail address and it contained a space at the end of the string. that was what was cauing it to fail...
Amazing.. I actually heard a great comment... another support person told me....
"Application was working perfectly and then the user did something magical.. and now we get this error...!!"
Thanks for the help all
Rich |
|
|
|
Re: E-Mail Validation
Posted: 02 Feb 07 11:27 AM
|
fiogf49gjkf0d Heh. Glad you figured it out. Good luck with your users.
By the way, presumably you're going to modify your code to trim the string, right? |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|