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,032
19년 전 조회 2,169
19년 전 조회 1,723
19년 전 조회 2,414
19년 전 조회 2,069
19년 전 조회 1,683
19년 전 조회 1,855
19년 전 조회 2,114
19년 전 조회 1,887
19년 전 조회 1,663
19년 전 조회 1,726
19년 전 조회 3,224
19년 전 조회 2,078
19년 전 조회 1,934
19년 전 조회 4,441
19년 전 조회 5,065
19년 전 조회 3,229
19년 전 조회 2,969
19년 전 조회 3,572
19년 전 조회 2,113
19년 전 조회 2,475
19년 전 조회 2,756
19년 전 조회 2,839
19년 전 조회 2,441
19년 전 조회 1,700
19년 전 조회 3,465
19년 전 조회 2,048
19년 전 조회 2,458
19년 전 조회 2,528
19년 전 조회 2,962
19년 전 조회 5,297
19년 전 조회 2,552
19년 전 조회 3,388
19년 전 조회 4,337
19년 전 조회 2,580
19년 전 조회 2,530
19년 전 조회 4,118
19년 전 조회 2,814
19년 전 조회 3,057
19년 전 조회 2,285
19년 전 조회 2,296
19년 전 조회 2,073
19년 전 조회 3,366
19년 전 조회 2,193
19년 전 조회 2,872
19년 전 조회 1,829
19년 전 조회 5,381
19년 전 조회 3,637
19년 전 조회 4,391
19년 전 조회 3,125
19년 전 조회 2,605
19년 전 조회 3,991
19년 전 조회 2,721
19년 전 조회 3,061
19년 전 조회 3,039
19년 전 조회 4,243
19년 전 조회 3,215
19년 전 조회 3,086
19년 전 조회 3,771
19년 전 조회 3,070
19년 전 조회 2,293
19년 전 조회 2,303
19년 전 조회 2,249
19년 전 조회 2,853
19년 전 조회 2,553
19년 전 조회 3,414
19년 전 조회 3,274
19년 전 조회 1,887
19년 전 조회 2,820
19년 전 조회 7,911
19년 전 조회 2,591
19년 전 조회 3,188
19년 전 조회 2,955
19년 전 조회 3,089
19년 전 조회 2,290
19년 전 조회 2,530
19년 전 조회 4,131
19년 전 조회 2,318
19년 전 조회 4,299
19년 전 조회 2,472
19년 전 조회 2,153
19년 전 조회 2,396
19년 전 조회 1,955
19년 전 조회 2,479
19년 전 조회 2,270
19년 전 조회 3,139
19년 전 조회 1,929
19년 전 조회 3,609
19년 전 조회 2,784
19년 전 조회 3,505
19년 전 조회 3,517
19년 전 조회 3,214
19년 전 조회 5,508
19년 전 조회 2,255
19년 전 조회 2,295
19년 전 조회 2,398
19년 전 조회 3,468
19년 전 조회 3,774
19년 전 조회 3,804
19년 전 조회 2,423