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년 전 조회 2,163
19년 전 조회 2,310
19년 전 조회 1,868
19년 전 조회 2,559
19년 전 조회 2,196
19년 전 조회 1,810
19년 전 조회 2,000
19년 전 조회 2,262
19년 전 조회 2,019
19년 전 조회 1,805
19년 전 조회 1,874
19년 전 조회 3,364
19년 전 조회 2,220
19년 전 조회 2,080
19년 전 조회 4,572
19년 전 조회 5,196
19년 전 조회 3,365
19년 전 조회 3,107
19년 전 조회 3,705
19년 전 조회 2,246
19년 전 조회 2,606
19년 전 조회 2,906
19년 전 조회 2,972
19년 전 조회 2,572
19년 전 조회 1,836
19년 전 조회 3,625
19년 전 조회 2,195
19년 전 조회 2,601
19년 전 조회 2,668
19년 전 조회 3,096
19년 전 조회 5,423
19년 전 조회 2,707
19년 전 조회 3,533
19년 전 조회 4,469
19년 전 조회 2,731
19년 전 조회 2,673
19년 전 조회 4,262
19년 전 조회 2,962
19년 전 조회 3,195
19년 전 조회 2,418
19년 전 조회 2,423
19년 전 조회 2,216
19년 전 조회 3,512
19년 전 조회 2,319
19년 전 조회 3,009
19년 전 조회 1,951
19년 전 조회 5,516
19년 전 조회 3,782
19년 전 조회 4,529
19년 전 조회 3,274
19년 전 조회 2,745
19년 전 조회 4,146
19년 전 조회 2,863
19년 전 조회 3,202
19년 전 조회 3,178
19년 전 조회 4,387
19년 전 조회 3,333
19년 전 조회 3,221
19년 전 조회 3,910
19년 전 조회 3,201
19년 전 조회 2,432
19년 전 조회 2,440
19년 전 조회 2,379
19년 전 조회 3,003
19년 전 조회 2,706
19년 전 조회 3,555
19년 전 조회 3,424
19년 전 조회 2,027
19년 전 조회 2,960
19년 전 조회 8,042
19년 전 조회 2,725
19년 전 조회 3,327
19년 전 조회 3,093
19년 전 조회 3,197
19년 전 조회 2,447
19년 전 조회 2,671
19년 전 조회 4,272
19년 전 조회 2,462
19년 전 조회 4,448
19년 전 조회 2,614
19년 전 조회 2,292
19년 전 조회 2,537
19년 전 조회 2,093
19년 전 조회 2,621
19년 전 조회 2,409
19년 전 조회 3,280
19년 전 조회 2,057
19년 전 조회 3,738
19년 전 조회 2,916
19년 전 조회 3,632
19년 전 조회 3,662
19년 전 조회 3,357
19년 전 조회 5,647
19년 전 조회 2,383
19년 전 조회 2,424
19년 전 조회 2,529
19년 전 조회 3,605
19년 전 조회 3,932
19년 전 조회 3,946
19년 전 조회 2,566