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,089
19년 전 조회 1,624
19년 전 조회 2,332
19년 전 조회 1,985
19년 전 조회 1,596
19년 전 조회 1,777
19년 전 조회 2,031
19년 전 조회 1,782
19년 전 조회 1,587
19년 전 조회 1,650
19년 전 조회 3,117
19년 전 조회 1,987
19년 전 조회 1,859
19년 전 조회 4,359
19년 전 조회 4,986
19년 전 조회 3,150
19년 전 조회 2,883
19년 전 조회 3,485
19년 전 조회 2,030
19년 전 조회 2,382
19년 전 조회 2,681
19년 전 조회 2,754
19년 전 조회 2,343
19년 전 조회 1,607
19년 전 조회 3,374
19년 전 조회 1,968
19년 전 조회 2,378
19년 전 조회 2,444
19년 전 조회 2,868
19년 전 조회 5,197
19년 전 조회 2,480
19년 전 조회 3,321
19년 전 조회 4,261
19년 전 조회 2,497
19년 전 조회 2,455
19년 전 조회 4,020
19년 전 조회 2,737
19년 전 조회 2,984
19년 전 조회 2,195
19년 전 조회 2,214
19년 전 조회 1,994
19년 전 조회 3,273
19년 전 조회 2,108
19년 전 조회 2,782
19년 전 조회 1,738
19년 전 조회 5,308
19년 전 조회 3,557
19년 전 조회 4,307
19년 전 조회 3,053
19년 전 조회 2,519
19년 전 조회 3,920
19년 전 조회 2,643
19년 전 조회 2,982
19년 전 조회 2,950
19년 전 조회 4,169
19년 전 조회 3,118
19년 전 조회 3,016
19년 전 조회 3,670
19년 전 조회 2,971
19년 전 조회 2,196
19년 전 조회 2,220
19년 전 조회 2,159
19년 전 조회 2,764
19년 전 조회 2,475
19년 전 조회 3,340
19년 전 조회 3,191
19년 전 조회 1,821
19년 전 조회 2,732
19년 전 조회 7,821
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,401
19년 전 조회 2,193
19년 전 조회 3,062
19년 전 조회 1,843
19년 전 조회 3,538
19년 전 조회 2,694
19년 전 조회 3,440
19년 전 조회 3,440
19년 전 조회 3,143
19년 전 조회 5,430
19년 전 조회 2,164
19년 전 조회 2,214
19년 전 조회 2,308
19년 전 조회 3,388
19년 전 조회 3,696
19년 전 조회 3,740
19년 전 조회 2,347
🐛 버그신고