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,948
19년 전 조회 2,090
19년 전 조회 1,626
19년 전 조회 2,332
19년 전 조회 1,985
19년 전 조회 1,597
19년 전 조회 1,777
19년 전 조회 2,031
19년 전 조회 1,783
19년 전 조회 1,587
19년 전 조회 1,650
19년 전 조회 3,117
19년 전 조회 1,988
19년 전 조회 1,859
19년 전 조회 4,360
19년 전 조회 4,988
19년 전 조회 3,150
19년 전 조회 2,883
19년 전 조회 3,486
19년 전 조회 2,032
19년 전 조회 2,383
19년 전 조회 2,681
19년 전 조회 2,755
19년 전 조회 2,345
19년 전 조회 1,607
19년 전 조회 3,374
19년 전 조회 1,969
19년 전 조회 2,378
19년 전 조회 2,444
19년 전 조회 2,869
19년 전 조회 5,198
19년 전 조회 2,481
19년 전 조회 3,321
19년 전 조회 4,262
19년 전 조회 2,497
19년 전 조회 2,455
19년 전 조회 4,020
19년 전 조회 2,739
19년 전 조회 2,986
19년 전 조회 2,196
19년 전 조회 2,214
19년 전 조회 1,994
19년 전 조회 3,274
19년 전 조회 2,108
19년 전 조회 2,782
19년 전 조회 1,739
19년 전 조회 5,308
19년 전 조회 3,557
19년 전 조회 4,307
19년 전 조회 3,054
19년 전 조회 2,519
19년 전 조회 3,921
19년 전 조회 2,643
19년 전 조회 2,982
19년 전 조회 2,950
19년 전 조회 4,170
19년 전 조회 3,118
19년 전 조회 3,016
19년 전 조회 3,672
19년 전 조회 2,972
19년 전 조회 2,196
19년 전 조회 2,221
19년 전 조회 2,160
19년 전 조회 2,765
19년 전 조회 2,475
19년 전 조회 3,340
19년 전 조회 3,192
19년 전 조회 1,821
19년 전 조회 2,733
19년 전 조회 7,822
19년 전 조회 2,495
19년 전 조회 3,102
19년 전 조회 2,852
19년 전 조회 3,008
19년 전 조회 2,215
19년 전 조회 2,445
19년 전 조회 4,067
19년 전 조회 2,222
19년 전 조회 4,221
19년 전 조회 2,379
19년 전 조회 2,075
19년 전 조회 2,323
19년 전 조회 1,865
19년 전 조회 2,402
19년 전 조회 2,193
19년 전 조회 3,062
19년 전 조회 1,843
19년 전 조회 3,539
19년 전 조회 2,695
19년 전 조회 3,440
19년 전 조회 3,441
19년 전 조회 3,143
19년 전 조회 5,430
19년 전 조회 2,164
19년 전 조회 2,214
19년 전 조회 2,308
19년 전 조회 3,389
19년 전 조회 3,696
19년 전 조회 3,741
19년 전 조회 2,348
🐛 버그신고