verify email address format
#1

Hi. anyone knows how to check the format of an email address in pawno. Thank you very much. sorry for my English.
Reply
#2

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)