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,054
19년 전 조회 2,193
19년 전 조회 1,749
19년 전 조회 2,440
19년 전 조회 2,089
19년 전 조회 1,708
19년 전 조회 1,885
19년 전 조회 2,141
19년 전 조회 1,910
19년 전 조회 1,689
19년 전 조회 1,750
19년 전 조회 3,252
19년 전 조회 2,103
19년 전 조회 1,967
19년 전 조회 4,468
19년 전 조회 5,097
19년 전 조회 3,260
19년 전 조회 2,993
19년 전 조회 3,598
19년 전 조회 2,140
19년 전 조회 2,502
19년 전 조회 2,787
19년 전 조회 2,866
19년 전 조회 2,464
19년 전 조회 1,728
19년 전 조회 3,501
19년 전 조회 2,075
19년 전 조회 2,482
19년 전 조회 2,549
19년 전 조회 2,987
19년 전 조회 5,312
19년 전 조회 2,582
19년 전 조회 3,415
19년 전 조회 4,359
19년 전 조회 2,601
19년 전 조회 2,550
19년 전 조회 4,143
19년 전 조회 2,843
19년 전 조회 3,078
19년 전 조회 2,304
19년 전 조회 2,320
19년 전 조회 2,100
19년 전 조회 3,397
19년 전 조회 2,219
19년 전 조회 2,901
19년 전 조회 1,847
19년 전 조회 5,402
19년 전 조회 3,660
19년 전 조회 4,420
19년 전 조회 3,160
19년 전 조회 2,628
19년 전 조회 4,015
19년 전 조회 2,750
19년 전 조회 3,085
19년 전 조회 3,067
19년 전 조회 4,270
19년 전 조회 3,232
19년 전 조회 3,111
19년 전 조회 3,797
19년 전 조회 3,093
19년 전 조회 2,316
19년 전 조회 2,324
19년 전 조회 2,268
19년 전 조회 2,880
19년 전 조회 2,574
19년 전 조회 3,448
19년 전 조회 3,301
19년 전 조회 1,925
19년 전 조회 2,842
19년 전 조회 7,930
19년 전 조회 2,607
19년 전 조회 3,212
19년 전 조회 2,972
19년 전 조회 3,108
19년 전 조회 2,312
19년 전 조회 2,551
19년 전 조회 4,155
19년 전 조회 2,342
19년 전 조회 4,323
19년 전 조회 2,499
19년 전 조회 2,182
19년 전 조회 2,422
19년 전 조회 1,977
19년 전 조회 2,508
19년 전 조회 2,297
19년 전 조회 3,170
19년 전 조회 1,957
19년 전 조회 3,636
19년 전 조회 2,811
19년 전 조회 3,528
19년 전 조회 3,549
19년 전 조회 3,249
19년 전 조회 5,539
19년 전 조회 2,273
19년 전 조회 2,322
19년 전 조회 2,432
19년 전 조회 3,495
19년 전 조회 3,806
19년 전 조회 3,833
19년 전 조회 2,450