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,041
19년 전 조회 2,176
19년 전 조회 1,732
19년 전 조회 2,424
19년 전 조회 2,078
19년 전 조회 1,691
19년 전 조회 1,868
19년 전 조회 2,124
19년 전 조회 1,898
19년 전 조회 1,669
19년 전 조회 1,733
19년 전 조회 3,233
19년 전 조회 2,087
19년 전 조회 1,945
19년 전 조회 4,452
19년 전 조회 5,077
19년 전 조회 3,239
19년 전 조회 2,979
19년 전 조회 3,578
19년 전 조회 2,121
19년 전 조회 2,487
19년 전 조회 2,768
19년 전 조회 2,850
19년 전 조회 2,447
19년 전 조회 1,706
19년 전 조회 3,477
19년 전 조회 2,055
19년 전 조회 2,464
19년 전 조회 2,532
19년 전 조회 2,972
19년 전 조회 5,302
19년 전 조회 2,559
19년 전 조회 3,398
19년 전 조회 4,350
19년 전 조회 2,586
19년 전 조회 2,538
19년 전 조회 4,126
19년 전 조회 2,825
19년 전 조회 3,062
19년 전 조회 2,290
19년 전 조회 2,303
19년 전 조회 2,081
19년 전 조회 3,381
19년 전 조회 2,204
19년 전 조회 2,878
19년 전 조회 1,834
19년 전 조회 5,388
19년 전 조회 3,641
19년 전 조회 4,397
19년 전 조회 3,136
19년 전 조회 2,614
19년 전 조회 4,003
19년 전 조회 2,730
19년 전 조회 3,066
19년 전 조회 3,047
19년 전 조회 4,253
19년 전 조회 3,226
19년 전 조회 3,098
19년 전 조회 3,780
19년 전 조회 3,076
19년 전 조회 2,299
19년 전 조회 2,307
19년 전 조회 2,256
19년 전 조회 2,864
19년 전 조회 2,562
19년 전 조회 3,428
19년 전 조회 3,285
19년 전 조회 1,900
19년 전 조회 2,830
19년 전 조회 7,918
19년 전 조회 2,595
19년 전 조회 3,194
19년 전 조회 2,959
19년 전 조회 3,097
19년 전 조회 2,295
19년 전 조회 2,537
19년 전 조회 4,139
19년 전 조회 2,326
19년 전 조회 4,307
19년 전 조회 2,479
19년 전 조회 2,160
19년 전 조회 2,405
19년 전 조회 1,963
19년 전 조회 2,485
19년 전 조회 2,277
19년 전 조회 3,147
19년 전 조회 1,938
19년 전 조회 3,619
19년 전 조회 2,797
19년 전 조회 3,514
19년 전 조회 3,533
19년 전 조회 3,231
19년 전 조회 5,519
19년 전 조회 2,260
19년 전 조회 2,301
19년 전 조회 2,413
19년 전 조회 3,478
19년 전 조회 3,785
19년 전 조회 3,817
19년 전 조회 2,429