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,257
19년 전 조회 1,815
19년 전 조회 2,499
19년 전 조회 2,140
19년 전 조회 1,754
19년 전 조회 1,946
19년 전 조회 2,200
19년 전 조회 1,968
19년 전 조회 1,751
19년 전 조회 1,808
19년 전 조회 3,307
19년 전 조회 2,159
19년 전 조회 2,021
19년 전 조회 4,520
19년 전 조회 5,144
19년 전 조회 3,318
19년 전 조회 3,057
19년 전 조회 3,658
19년 전 조회 2,188
19년 전 조회 2,548
19년 전 조회 2,850
19년 전 조회 2,915
19년 전 조회 2,519
19년 전 조회 1,782
19년 전 조회 3,567
19년 전 조회 2,139
19년 전 조회 2,542
19년 전 조회 2,602
19년 전 조회 3,049
19년 전 조회 5,364
19년 전 조회 2,644
19년 전 조회 3,485
19년 전 조회 4,418
19년 전 조회 2,678
19년 전 조회 2,619
19년 전 조회 4,208
19년 전 조회 2,909
19년 전 조회 3,141
19년 전 조회 2,368
19년 전 조회 2,369
19년 전 조회 2,163
19년 전 조회 3,454
19년 전 조회 2,269
19년 전 조회 2,952
19년 전 조회 1,903
19년 전 조회 5,459
19년 전 조회 3,720
19년 전 조회 4,478
19년 전 조회 3,216
19년 전 조회 2,690
19년 전 조회 4,073
19년 전 조회 2,805
19년 전 조회 3,152
19년 전 조회 3,119
19년 전 조회 4,327
19년 전 조회 3,287
19년 전 조회 3,164
19년 전 조회 3,860
19년 전 조회 3,147
19년 전 조회 2,382
19년 전 조회 2,380
19년 전 조회 2,325
19년 전 조회 2,948
19년 전 조회 2,645
19년 전 조회 3,496
19년 전 조회 3,359
19년 전 조회 1,983
19년 전 조회 2,900
19년 전 조회 7,985
19년 전 조회 2,665
19년 전 조회 3,272
19년 전 조회 3,038
19년 전 조회 3,154
19년 전 조회 2,385
19년 전 조회 2,616
19년 전 조회 4,211
19년 전 조회 2,406
19년 전 조회 4,389
19년 전 조회 2,565
19년 전 조회 2,244
19년 전 조회 2,478
19년 전 조회 2,038
19년 전 조회 2,569
19년 전 조회 2,349
19년 전 조회 3,224
19년 전 조회 2,010
19년 전 조회 3,684
19년 전 조회 2,863
19년 전 조회 3,586
19년 전 조회 3,607
19년 전 조회 3,309
19년 전 조회 5,585
19년 전 조회 2,328
19년 전 조회 2,376
19년 전 조회 2,478
19년 전 조회 3,552
19년 전 조회 3,869
19년 전 조회 3,895
19년 전 조회 2,509