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,050
19년 전 조회 2,186
19년 전 조회 1,743
19년 전 조회 2,431
19년 전 조회 2,084
19년 전 조회 1,699
19년 전 조회 1,879
19년 전 조회 2,134
19년 전 조회 1,903
19년 전 조회 1,681
19년 전 조회 1,742
19년 전 조회 3,249
19년 전 조회 2,094
19년 전 조회 1,961
19년 전 조회 4,464
19년 전 조회 5,092
19년 전 조회 3,248
19년 전 조회 2,988
19년 전 조회 3,588
19년 전 조회 2,134
19년 전 조회 2,495
19년 전 조회 2,781
19년 전 조회 2,853
19년 전 조회 2,455
19년 전 조회 1,721
19년 전 조회 3,492
19년 전 조회 2,069
19년 전 조회 2,477
19년 전 조회 2,541
19년 전 조회 2,981
19년 전 조회 5,311
19년 전 조회 2,574
19년 전 조회 3,405
19년 전 조회 4,356
19년 전 조회 2,596
19년 전 조회 2,546
19년 전 조회 4,135
19년 전 조회 2,834
19년 전 조회 3,070
19년 전 조회 2,299
19년 전 조회 2,316
19년 전 조회 2,091
19년 전 조회 3,392
19년 전 조회 2,213
19년 전 조회 2,894
19년 전 조회 1,839
19년 전 조회 5,400
19년 전 조회 3,654
19년 전 조회 4,409
19년 전 조회 3,149
19년 전 조회 2,624
19년 전 조회 4,009
19년 전 조회 2,738
19년 전 조회 3,074
19년 전 조회 3,062
19년 전 조회 4,266
19년 전 조회 3,229
19년 전 조회 3,107
19년 전 조회 3,790
19년 전 조회 3,090
19년 전 조회 2,308
19년 전 조회 2,317
19년 전 조회 2,262
19년 전 조회 2,871
19년 전 조회 2,571
19년 전 조회 3,440
19년 전 조회 3,295
19년 전 조회 1,912
19년 전 조회 2,837
19년 전 조회 7,924
19년 전 조회 2,603
19년 전 조회 3,207
19년 전 조회 2,966
19년 전 조회 3,103
19년 전 조회 2,303
19년 전 조회 2,547
19년 전 조회 4,149
19년 전 조회 2,334
19년 전 조회 4,318
19년 전 조회 2,494
19년 전 조회 2,173
19년 전 조회 2,415
19년 전 조회 1,974
19년 전 조회 2,502
19년 전 조회 2,293
19년 전 조회 3,160
19년 전 조회 1,950
19년 전 조회 3,627
19년 전 조회 2,806
19년 전 조회 3,523
19년 전 조회 3,545
19년 전 조회 3,244
19년 전 조회 5,531
19년 전 조회 2,267
19년 전 조회 2,314
19년 전 조회 2,427
19년 전 조회 3,485
19년 전 조회 3,801
19년 전 조회 3,826
19년 전 조회 2,442