At 12:30 12/6/2010, Ross Dickson wrote:
>WD,
>
>One way is to create several calculated fields, each comprising one of the criteria.
>So, you have the following fields:Â
>Â Â Email (text)
>Â Â endsEmail (calc txt) = Left(Email,1) & Right(Email,1)
>Â Â posDomain (calc, num) = Position (Email,"@",1,1)
>Â Â Domain (calc, txt) = Case (posDomain, Right (Email, Length(Email)-posDomain))
>Â Â leftDomain (calc, txt) = Left (Domain,1)
>Â Â posTLD (calc, num) = Case (posDomain, Position(Domain,".",1,1))
>Â Â TLD (calc, txt) = Case (posTLD, Right(Domain, Length(Domain)-posLTD))
>Â Â posDot (calc, num) = Position(Email,".",1,1)
>Â Â countanEmail (calc, num) = PatternCount(Email,"a") + PatternCount(Email,"b") ++ PatternCount(Email,"9") ++Â
>Â Â Â Â - -Â (only need lower case letters, numbers and extra permitted characters)
>Â Â countaEndsEmail (Calc, txt) =Â PatternCount(endsEmail,"a") +++Â PatternCount(endsEmail,"z")Â
>Â Â Â Â - -Â (only need lower case letters)
>Â Â countaLeftDomain (calc, num) = PatternCount(leftDomain,"a") +++Â PatternCount(leftDomain,"z")Â Â
>Â Â Â Â - -Â (only need lower case letters)
>Â Â countAtEmail (calc, num) = PatternCount(Email,"@")
>Then combining these results
>Â Â ValidEmail (calc, txt) =Â Case(Â
>Â Â Â Â not IsEmpty(Email) and
>Â Â Â Â countanEmail =Â Length(Email) and
>Â Â Â Â countAtEmail = 1 and
>Â Â Â Â countaEndsEmail = 2 and
>Â Â Â Â countanLeftDomain = 1 and
>Â Â Â Â PatternCount(Email, "..") = 0 and
>    Middle(Email,posDomain-1,1)  ≠"." and
>Â Â Â Â not IsEmpty(TLD),
>Â Â Â Â "Valid", "Invalid")
>
>If you're feeling really confident, all of these calculations can be combined into one final Validation calculation. It might be a little difficult to check for bugs though.
>
>Ross
Excellent. I'll work on this.
Funny how the post has all these "Â" in it?
>On Mon, Dec 6, 2010 at 1:36 AM, W. D. <<mailto:[log in to unmask]>[log in to unmask]> wrote:
>Michael Rhodes has a good one for modern versions:
>
>/*
>Created October 12, 2008
>Updated December 5, 2010
>
>Since new top-level domains are constantly added, this function assumes the top-level domain is legitimate and validates only the email format.
>Returns a True value if the parameter is a correctly formatted email address.
>
>Created by Michael Rhodes
><mailto:[log in to unmask]>[log in to unmask]
>Anybody may use this function so long as they keep my contact info in the comments of the function.
>*/
>
>IsEmpty ( text )
>or
>Let ( [
>Â alphanum = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ;
>Â textEnds = Left ( text; 1 ) & Right ( text; 1 ) ;
>Â posDomain = Position ( text; "@"; 1; 1 ) ;
>Â domain = If ( posDomain; Right ( text; Length ( text ) - posDomain ) ) ;
>Â leftChar = Left ( domain; 1 ) ;
>Â posTLD = If ( posDomain; Position ( domain; "."; 1; 1 ) ) ;
>Â TLD = If ( posTLD; Right ( domain; Length ( domain ) - posTLD ) )
>] ;
> Filter ( text; alphanum & "[log in to unmask]" ) = text  // There are no invalid characters.
>Â and PatternCount ( text; "@" ) = 1 Â // There is only one @ symbol.
> and Filter ( textEnds; alphanum) = textEnds  // First and last character are alphanumeric.
>Â and not Position ( text; ".."; 1; 1 )
>Â and Middle ( text; posDomain - 1; 1 ) <> "."
>Â and Filter ( leftChar; alphanum ) = leftChar
>Â and not IsEmpty ( TLD )
>) // end let
>
>Anyone have any suggestions for version 6?
>
>
>Start Here to Find It Fast!™ -> <http://www.US-Webmastters.com/best-start-page/>http://www.US-Webmasters.com/best-start-page/
>$8.77 Domain Names -> <http://domains.us-webmasters.com/>http://domains.us-webmasters.com/
>
Start Here to Find It Fast!™ -> http://www.US-Webmasters.com/best-start-page/
$8.77 Domain Names -> http://domains.us-webmasters.com/
|