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,304
19년 전 조회 2,435
19년 전 조회 1,974
19년 전 조회 2,689
19년 전 조회 2,327
19년 전 조회 1,954
19년 전 조회 2,123
19년 전 조회 2,375
19년 전 조회 2,126
19년 전 조회 1,936
19년 전 조회 1,999
19년 전 조회 3,476
19년 전 조회 2,352
19년 전 조회 2,202
19년 전 조회 4,712
19년 전 조회 5,328
19년 전 조회 3,490
19년 전 조회 3,229
19년 전 조회 3,837
19년 전 조회 2,376
19년 전 조회 2,730
19년 전 조회 3,027
19년 전 조회 3,110
19년 전 조회 2,698
19년 전 조회 1,962
19년 전 조회 3,745
19년 전 조회 2,328
19년 전 조회 2,732
19년 전 조회 2,809
19년 전 조회 3,221
19년 전 조회 5,537
19년 전 조회 2,829
19년 전 조회 3,665
19년 전 조회 4,623
19년 전 조회 2,870
19년 전 조회 2,805
19년 전 조회 4,391
19년 전 조회 3,095
19년 전 조회 3,341
19년 전 조회 2,535
19년 전 조회 2,559
19년 전 조회 2,352
19년 전 조회 3,637
19년 전 조회 2,468
19년 전 조회 3,145
19년 전 조회 2,074
19년 전 조회 5,656
19년 전 조회 3,923
19년 전 조회 4,667
19년 전 조회 3,411
19년 전 조회 2,874
19년 전 조회 4,270
19년 전 조회 3,008
19년 전 조회 3,350
19년 전 조회 3,307
19년 전 조회 4,513
19년 전 조회 3,470
19년 전 조회 3,355
19년 전 조회 4,039
19년 전 조회 3,335
19년 전 조회 2,580
19년 전 조회 2,575
19년 전 조회 2,529
19년 전 조회 3,146
19년 전 조회 2,854
19년 전 조회 3,704
19년 전 조회 3,546
19년 전 조회 2,175
19년 전 조회 3,099
19년 전 조회 8,189
19년 전 조회 2,864
19년 전 조회 3,492
19년 전 조회 3,215
19년 전 조회 3,362
19년 전 조회 2,568
19년 전 조회 2,811
19년 전 조회 4,413
19년 전 조회 2,581
19년 전 조회 4,587
19년 전 조회 2,738
19년 전 조회 2,446
19년 전 조회 2,696
19년 전 조회 2,216
19년 전 조회 2,758
19년 전 조회 2,556
19년 전 조회 3,414
19년 전 조회 2,192
19년 전 조회 3,907
19년 전 조회 3,065
19년 전 조회 3,782
19년 전 조회 3,806
19년 전 조회 3,501
19년 전 조회 5,791
19년 전 조회 2,512
19년 전 조회 2,563
19년 전 조회 2,652
19년 전 조회 3,733
19년 전 조회 4,051
19년 전 조회 4,085
19년 전 조회 2,697