verify email address format - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: verify email address format (
/showthread.php?tid=617060)
verify email address format -
angelxeneize - 15.09.2016
Hi. anyone knows how to check the format of an email address in pawno. Thank you very much. sorry for my English.
Re: verify email address format -
Threshold - 15.09.2016
There are multiple methods of doing so, but the majority of them will never be 100% accurate. There are so many domains that users can appear from, like .ru, .tk, .net, .com... If you want a simple and very basic email address detection, you should look for a '.' and a '@' symbol using 'strfind' or looping through the string.
https://sampwiki.blast.hk/wiki/Strfind
https://sampwiki.blast.hk/wiki/Control_Structures#for
Another method would be to use RegEx (or regular expression) or simply use sscanf.
After some searching I found a post made by Vince recently which sums this up pretty nicely.
Quote:
Originally Posted by Vince
That's really a dumb solution, to be honest. I have an e-mail address under my own domain, which will surely not be in your array.
The most thorough solution is a regular expression. But if you don't want to use that plugin you can probably also get by using sscanf, using something like:
PHP код:
"{s[256]'@'s[256]'.'s[256]}"
Since it's a quiet expression (curly braces) string size does not matter.
|
But again, that doesn't necessarily guarantee that the email address actually exists.