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,962
19년 전 조회 2,106
19년 전 조회 1,644
19년 전 조회 2,347
19년 전 조회 2,001
19년 전 조회 1,611
19년 전 조회 1,793
19년 전 조회 2,048
19년 전 조회 1,794
19년 전 조회 1,600
19년 전 조회 1,663
19년 전 조회 3,131
19년 전 조회 2,005
19년 전 조회 1,876
19년 전 조회 4,377
19년 전 조회 5,004
19년 전 조회 3,167
19년 전 조회 2,902
19년 전 조회 3,502
19년 전 조회 2,048
19년 전 조회 2,395
19년 전 조회 2,690
19년 전 조회 2,773
19년 전 조회 2,359
19년 전 조회 1,621
19년 전 조회 3,386
19년 전 조회 1,984
19년 전 조회 2,400
19년 전 조회 2,461
19년 전 조회 2,881
19년 전 조회 5,210
19년 전 조회 2,493
19년 전 조회 3,336
19년 전 조회 4,278
19년 전 조회 2,512
19년 전 조회 2,468
19년 전 조회 4,039
19년 전 조회 2,755
19년 전 조회 2,998
19년 전 조회 2,213
19년 전 조회 2,226
19년 전 조회 2,006
19년 전 조회 3,287
19년 전 조회 2,124
19년 전 조회 2,801
19년 전 조회 1,751
19년 전 조회 5,323
19년 전 조회 3,568
19년 전 조회 4,321
19년 전 조회 3,069
19년 전 조회 2,535
19년 전 조회 3,935
19년 전 조회 2,655
19년 전 조회 2,998
19년 전 조회 2,960
19년 전 조회 4,187
19년 전 조회 3,131
19년 전 조회 3,030
19년 전 조회 3,683
19년 전 조회 2,989
19년 전 조회 2,217
19년 전 조회 2,229
19년 전 조회 2,173
19년 전 조회 2,774
19년 전 조회 2,491
19년 전 조회 3,353
19년 전 조회 3,205
19년 전 조회 1,830
19년 전 조회 2,743
19년 전 조회 7,837
19년 전 조회 2,513
19년 전 조회 3,120
19년 전 조회 2,868
19년 전 조회 3,022
19년 전 조회 2,231
19년 전 조회 2,456
19년 전 조회 4,080
19년 전 조회 2,233
19년 전 조회 4,236
19년 전 조회 2,393
19년 전 조회 2,087
19년 전 조회 2,338
19년 전 조회 1,881
19년 전 조회 2,411
19년 전 조회 2,205
19년 전 조회 3,073
19년 전 조회 1,857
19년 전 조회 3,554
19년 전 조회 2,707
19년 전 조회 3,454
19년 전 조회 3,454
19년 전 조회 3,158
19년 전 조회 5,446
19년 전 조회 2,175
19년 전 조회 2,227
19년 전 조회 2,318
19년 전 조회 3,404
19년 전 조회 3,710
19년 전 조회 3,758
19년 전 조회 2,358