Created
October 7, 2020 13:48
-
-
Save trycf/7b8590667278453962df9783ccfc5abb to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
function checkExamples(examples){ | |
loop list="#examples#" item="email" delimiters="#chr(10)##chr(13)#"{ | |
ok = isValid("email", email) | |
if (ok) | |
echo ("#email#<br>"); | |
else | |
echo ("<b>#email# FAIL</b><br>"); | |
} | |
echo("<hr>"); | |
} | |
</cfscript> | |
<!--- examples from from https://en.wikipedia.org/wiki/Email_address#Local-part ---> | |
<cfsavecontent variable="valid_examples"> | |
simple@example.com | |
very.common@example.com | |
disposable.style.email.with+symbol@example.com | |
other.email-with-hyphen@example.com | |
fully-qualified-domain@example.com | |
user.name+tag+sorting@example.com | |
x@example.com | |
example-indeed@strange-example.com | |
admin@mailserver1 | |
example@s.example | |
" "@example.org | |
"john..doe"@example.org | |
mailhost!username@example.org | |
user%example.com@example.org | |
</cfsavecontent> | |
<cfsavecontent variable="invalid_examples"> | |
Abc.example.com | |
A@b@c@example.com | |
a"b(c)d,e:f;g<h>i[j\k]l@example.com | |
just"not"right@example.com | |
this is"not\allowed@example.com | |
this\ still\"not\\allowed@example.com | |
1234567890123456789012345678901234567890123456789012345678901234+x@example.com | |
i_like_underscore@but_its_not_allow_in_this_part.example.com | |
</cfsavecontent> | |
<h1>valid examples</h1> | |
<cfscript> | |
checkExamples(valid_examples); | |
</cfscript> | |
<h1>invalid examples</h1> | |
<cfscript> | |
checkExamples(invalid_examples); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment