View previous topic :: View next topic |
Author |
Message |
DelWolf Newbie
Joined: 16 Oct 2004 Posts: 4
|
Posted: Sat Oct 16, 2004 9:18 am Post subject: Validate Emails |
|
|
Hello everyone,
Can someone help me work this problem out?
I have a list of emails and i need to validate them.
I need to make sure they are valid, meaning they have an @ and the dot in the .com, etc.
I need to make sure that i can use the address.
so i would need it to say if i had an email like
someone@someplace,com
I want it to say something about the comma being before com and give me chance to change it. |
|
Back to top |
|
|
Vic D'Elfant Past Contributor
Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Sat Oct 16, 2004 9:28 am Post subject: |
|
|
First of all: welcome to VDSWORLD!
I think the script below be able to do what you need:
Code: |
%%Input = "vic@pythago.nl"
option fieldsep, "@"
parse "%%Username;%%Domain", %%Input
option fieldsep, |
if @null(%%Domain)
warn There's an "@" missing in the email address
elsif @zero(@pos(".", %%Domain))
warn There is no dot in the domain name
else
info Valid email
end |
Good luck
Vic _________________ phpBB Development Team |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sat Oct 16, 2004 9:33 am Post subject: |
|
|
hi DelWolf and welcome to our forum,
to answer your question, use the @pos() function to see if a string such as "@" is present or not
if it is, a number bigger than 1 is returned, and if it isn't then a 0 is returned
for example (off the top of my head so i hope it is right)
Code: |
if @greater(@pos(@chr(064),%%email_address),0)
rem email address contains @
end
if @greater(@pos(.com,%%email_address),0)
rem %%email address contains .com
end
|
hope this helps
serge _________________
|
|
Back to top |
|
|
GeoTrail Valued Contributor
Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Sun Oct 17, 2004 11:35 pm Post subject: |
|
|
Should also check that the @ and the . isn't at the very beginning or end and that there is atleast two characters before @ and after, and after the .
_________________
|
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Oct 19, 2004 12:06 am Post subject: |
|
|
Boredom:
Code: |
%%email = "test@vdsworldtest.com"
gosub Validate
%%email = "t@vdsworldtest.c"
gosub Validate
%%email = "sfadgdag"
gosub Validate
exit
:Validate
%%atpos = @POS("@",%%email)
%%dotpos = @POS(".",%%email)
if @NOT(@GREATER(%%atpos,0))
WARN There is no @CHR(34)"@"@CHR(34) in the inputed address.
exit
end
if @NOT(@GREATER(%%dotpos,0))
WARN "There is no "." in the inputed address."
exit
end
if @BOTH(@GREATER(%%atpos,2),@GREATER(%%dotpos,0))
if @GREATER(@FSUB(@LEN(%%email),%%dotpos),2)
INFO %%email is Valid.
else
WARN There is only one character after the @CHR(34)"."@CHR(34) in the inputed address.
end
else
WARN There is only one character before the @CHR(34)"@"@CHR(34) in the inputed address.
end
exit
|
_________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Tue Oct 19, 2004 3:03 pm Post subject: |
|
|
The latest version of String.dll has a function @string(IsEmail, [input string])
Checks whether the input string holding an email address conforms to standards.
The function relies on RFC 3696 - Application Techniques for Checking and Transformation of Names for validation rules
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
GeoTrail Valued Contributor
Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Nov 24, 2004 11:52 pm Post subject: |
|
|
Many companies have their employees full name as the email addy like this bill.gates@microsoft.com
So you could check for two or more dots before the @ and you could greet the user after entering the email addy.
Also, many companies who have offices in different citys and countries often have subdomains in their email addresses like @cal.microsoft.com _________________
|
|
Back to top |
|
|
GeoTrail Valued Contributor
Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Thu Nov 25, 2004 12:02 am Post subject: |
|
|
Dr. Dread, your email verifyer in the string.dll is very good.
I've tried all thinkable workarounds and I can't fool it. I even tried with html codes. Very nice work on the dll m8
I tried this Code: | %A = @string(Soundex, "Jan")
%B = @string(Soundex, "Jahn")
%C = @string(Soundex, "Jon")
%D = @string(Soundex, "John")
info Result is: %A %B %C %D | why does all return J500 ?
Jon and John are different, they are also different from Jan and Jahn when pronaunced in english. _________________
|
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
|
Back to top |
|
|
GeoTrail Valued Contributor
Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Thu Nov 25, 2004 1:52 pm Post subject: |
|
|
Thanks for the link Doc, I'll check that out _________________
|
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Nov 25, 2004 4:16 pm Post subject: |
|
|
Have fun
BTW, if you´re interested in that type of string comparison, I've been experimenting with
Metaphone and Levenshtein distance. They will probably be included in one of the next versions of string.dll
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
GeoTrail Valued Contributor
Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Thu Nov 25, 2004 4:27 pm Post subject: |
|
|
Cool, sounds great.
I'd be glad to assist in testing if you'd like.
Btw, I'm planning a sort of spell checker soon. That is why I'm interested in this _________________
|
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Fri Nov 26, 2004 12:48 am Post subject: |
|
|
Righto. Could make sense. I use Levenshtein for an online search engine - if a user query comes out empty,
suggestions can be made for alternative search terms being within a Levenshtein distance of 1 or 2 from
the original one.
I will let you know when I implement these functions.
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Fri Dec 03, 2004 7:23 am Post subject: |
|
|
I got the new functions going. It should be possible now to get not only Soundex but also Levenshtein distance,
Metaphone, Like percentage and Trigram.
If ya wanna check it out (won't release it until further tests have been done) PM me or mail me.
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
GeoTrail Valued Contributor
Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Fri Dec 03, 2004 1:25 pm Post subject: |
|
|
PM sent _________________
|
|
Back to top |
|
|
|