p

자바스크립트 이메일 체크 함수

function _check_email(email) {
var pattern = /^(.+)@(.+)$/;
var atom = "\[^\\s\\(\\)<>#@,;:!\\\\\\\"\\.\\[\\]\]+";
var word="(" + atom + "|(\"[^\"]*\"))";
var user_pattern = new RegExp("^" + word + "(\\." + word + ")*$");
var ip_pattern = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var domain_pattern = new RegExp("^" + atom + "(\\." + atom +")*$");

var arr = email.match(pattern);
if (!arr) return "Email address seems incorrect (check @ and .'s)";
if (!arr[1].match(user_pattern)) return "The username doesn't seem to be valid.";

var ip = arr[2].match(ip_pattern);
if (ip) {
for (var i=1; i<5; i++) if (ip[i] > 255) return "Destination IP address is invalid!";
}
else {
if (!arr[2].match(domain_pattern)) return "The domain name doesn't seem to be valid.";
var domain = arr[2].match(new RegExp(atom,"g"));
if (domain.length<2) return "This address is missing a hostname!";
if (domain[domain.length-1].length<2 || domain[domain.length-1].length>3)
return "The address must end in a three-letter domain, or two letter country.";
}
return false;
}<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
19년 전 조회 1,950
19년 전 조회 2,094
19년 전 조회 1,628
19년 전 조회 2,335
19년 전 조회 1,989
19년 전 조회 1,600
19년 전 조회 1,782
19년 전 조회 2,035
19년 전 조회 1,785
19년 전 조회 1,589
19년 전 조회 1,654
19년 전 조회 3,121
19년 전 조회 1,992
19년 전 조회 1,862
19년 전 조회 4,363
19년 전 조회 4,994
19년 전 조회 3,153
19년 전 조회 2,887
19년 전 조회 3,490
19년 전 조회 2,036
19년 전 조회 2,386
19년 전 조회 2,684
19년 전 조회 2,759
19년 전 조회 2,346
19년 전 조회 1,607
19년 전 조회 3,375
19년 전 조회 1,972
19년 전 조회 2,382
19년 전 조회 2,446
19년 전 조회 2,871
19년 전 조회 5,201
19년 전 조회 2,481
19년 전 조회 3,322
19년 전 조회 4,264
19년 전 조회 2,501
19년 전 조회 2,456
19년 전 조회 4,025
19년 전 조회 2,742
19년 전 조회 2,989
19년 전 조회 2,198
19년 전 조회 2,217
19년 전 조회 1,998
19년 전 조회 3,277
19년 전 조회 2,111
19년 전 조회 2,785
19년 전 조회 1,742
19년 전 조회 5,311
19년 전 조회 3,560
19년 전 조회 4,311
19년 전 조회 3,058
19년 전 조회 2,520
19년 전 조회 3,923
19년 전 조회 2,647
19년 전 조회 2,986
19년 전 조회 2,950
19년 전 조회 4,173
19년 전 조회 3,119
19년 전 조회 3,019
19년 전 조회 3,676
19년 전 조회 2,974
19년 전 조회 2,201
19년 전 조회 2,223
19년 전 조회 2,162
19년 전 조회 2,767
19년 전 조회 2,479
19년 전 조회 3,344
19년 전 조회 3,195
19년 전 조회 1,824
19년 전 조회 2,738
19년 전 조회 7,824
19년 전 조회 2,498
19년 전 조회 3,108
19년 전 조회 2,856
19년 전 조회 3,011
19년 전 조회 2,217
19년 전 조회 2,448
19년 전 조회 4,072
19년 전 조회 2,223
19년 전 조회 4,223
19년 전 조회 2,383
19년 전 조회 2,076
19년 전 조회 2,328
19년 전 조회 1,867
19년 전 조회 2,405
19년 전 조회 2,195
19년 전 조회 3,064
19년 전 조회 1,847
19년 전 조회 3,543
19년 전 조회 2,697
19년 전 조회 3,442
19년 전 조회 3,444
19년 전 조회 3,145
19년 전 조회 5,435
19년 전 조회 2,164
19년 전 조회 2,218
19년 전 조회 2,311
19년 전 조회 3,391
19년 전 조회 3,698
19년 전 조회 3,743
19년 전 조회 2,350
🐛 버그신고