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,103
19년 전 조회 2,256
19년 전 조회 1,813
19년 전 조회 2,498
19년 전 조회 2,137
19년 전 조회 1,752
19년 전 조회 1,943
19년 전 조회 2,199
19년 전 조회 1,965
19년 전 조회 1,749
19년 전 조회 1,805
19년 전 조회 3,304
19년 전 조회 2,158
19년 전 조회 2,021
19년 전 조회 4,519
19년 전 조회 5,141
19년 전 조회 3,317
19년 전 조회 3,053
19년 전 조회 3,654
19년 전 조회 2,188
19년 전 조회 2,545
19년 전 조회 2,846
19년 전 조회 2,914
19년 전 조회 2,517
19년 전 조회 1,782
19년 전 조회 3,565
19년 전 조회 2,136
19년 전 조회 2,540
19년 전 조회 2,598
19년 전 조회 3,048
19년 전 조회 5,363
19년 전 조회 2,641
19년 전 조회 3,483
19년 전 조회 4,418
19년 전 조회 2,677
19년 전 조회 2,616
19년 전 조회 4,207
19년 전 조회 2,908
19년 전 조회 3,138
19년 전 조회 2,366
19년 전 조회 2,367
19년 전 조회 2,158
19년 전 조회 3,451
19년 전 조회 2,265
19년 전 조회 2,950
19년 전 조회 1,899
19년 전 조회 5,457
19년 전 조회 3,718
19년 전 조회 4,477
19년 전 조회 3,213
19년 전 조회 2,687
19년 전 조회 4,073
19년 전 조회 2,804
19년 전 조회 3,150
19년 전 조회 3,118
19년 전 조회 4,326
19년 전 조회 3,281
19년 전 조회 3,161
19년 전 조회 3,856
19년 전 조회 3,146
19년 전 조회 2,381
19년 전 조회 2,377
19년 전 조회 2,321
19년 전 조회 2,942
19년 전 조회 2,643
19년 전 조회 3,493
19년 전 조회 3,357
19년 전 조회 1,979
19년 전 조회 2,900
19년 전 조회 7,984
19년 전 조회 2,662
19년 전 조회 3,268
19년 전 조회 3,038
19년 전 조회 3,154
19년 전 조회 2,383
19년 전 조회 2,612
19년 전 조회 4,210
19년 전 조회 2,405
19년 전 조회 4,387
19년 전 조회 2,561
19년 전 조회 2,242
19년 전 조회 2,477
19년 전 조회 2,036
19년 전 조회 2,567
19년 전 조회 2,348
19년 전 조회 3,223
19년 전 조회 2,006
19년 전 조회 3,681
19년 전 조회 2,859
19년 전 조회 3,584
19년 전 조회 3,606
19년 전 조회 3,308
19년 전 조회 5,585
19년 전 조회 2,327
19년 전 조회 2,370
19년 전 조회 2,477
19년 전 조회 3,549
19년 전 조회 3,867
19년 전 조회 3,892
19년 전 조회 2,505