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,318
19년 전 조회 2,444
19년 전 조회 1,985
19년 전 조회 2,701
19년 전 조회 2,337
19년 전 조회 1,963
19년 전 조회 2,131
19년 전 조회 2,383
19년 전 조회 2,130
19년 전 조회 1,943
19년 전 조회 2,010
19년 전 조회 3,481
19년 전 조회 2,363
19년 전 조회 2,209
19년 전 조회 4,721
19년 전 조회 5,345
19년 전 조회 3,497
19년 전 조회 3,235
19년 전 조회 3,847
19년 전 조회 2,387
19년 전 조회 2,737
19년 전 조회 3,032
19년 전 조회 3,118
19년 전 조회 2,702
19년 전 조회 1,971
19년 전 조회 3,750
19년 전 조회 2,332
19년 전 조회 2,741
19년 전 조회 2,814
19년 전 조회 3,228
19년 전 조회 5,542
19년 전 조회 2,839
19년 전 조회 3,672
19년 전 조회 4,632
19년 전 조회 2,878
19년 전 조회 2,815
19년 전 조회 4,396
19년 전 조회 3,105
19년 전 조회 3,353
19년 전 조회 2,545
19년 전 조회 2,567
19년 전 조회 2,359
19년 전 조회 3,646
19년 전 조회 2,474
19년 전 조회 3,154
19년 전 조회 2,081
19년 전 조회 5,661
19년 전 조회 3,929
19년 전 조회 4,678
19년 전 조회 3,422
19년 전 조회 2,877
19년 전 조회 4,274
19년 전 조회 3,017
19년 전 조회 3,360
19년 전 조회 3,316
19년 전 조회 4,522
19년 전 조회 3,480
19년 전 조회 3,364
19년 전 조회 4,045
19년 전 조회 3,343
19년 전 조회 2,582
19년 전 조회 2,583
19년 전 조회 2,540
19년 전 조회 3,152
19년 전 조회 2,862
19년 전 조회 3,707
19년 전 조회 3,554
19년 전 조회 2,182
19년 전 조회 3,102
19년 전 조회 8,194
19년 전 조회 2,872
19년 전 조회 3,498
19년 전 조회 3,220
19년 전 조회 3,365
19년 전 조회 2,577
19년 전 조회 2,821
19년 전 조회 4,424
19년 전 조회 2,592
19년 전 조회 4,595
19년 전 조회 2,745
19년 전 조회 2,452
19년 전 조회 2,703
19년 전 조회 2,223
19년 전 조회 2,763
19년 전 조회 2,564
19년 전 조회 3,420
19년 전 조회 2,200
19년 전 조회 3,924
19년 전 조회 3,073
19년 전 조회 3,794
19년 전 조회 3,810
19년 전 조회 3,512
19년 전 조회 5,796
19년 전 조회 2,522
19년 전 조회 2,573
19년 전 조회 2,659
19년 전 조회 3,740
19년 전 조회 4,056
19년 전 조회 4,092
19년 전 조회 2,707