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년 전 조회 1,955
19년 전 조회 2,099
19년 전 조회 1,635
19년 전 조회 2,341
19년 전 조회 2,000
19년 전 조회 1,606
19년 전 조회 1,786
19년 전 조회 2,042
19년 전 조회 1,792
19년 전 조회 1,595
19년 전 조회 1,660
19년 전 조회 3,128
19년 전 조회 1,997
19년 전 조회 1,871
19년 전 조회 4,371
19년 전 조회 4,998
19년 전 조회 3,162
19년 전 조회 2,892
19년 전 조회 3,499
19년 전 조회 2,043
19년 전 조회 2,392
19년 전 조회 2,687
19년 전 조회 2,764
19년 전 조회 2,352
19년 전 조회 1,613
19년 전 조회 3,383
19년 전 조회 1,979
19년 전 조회 2,392
19년 전 조회 2,451
19년 전 조회 2,875
19년 전 조회 5,207
19년 전 조회 2,489
19년 전 조회 3,330
19년 전 조회 4,272
19년 전 조회 2,510
19년 전 조회 2,463
19년 전 조회 4,034
19년 전 조회 2,748
19년 전 조회 2,993
19년 전 조회 2,207
19년 전 조회 2,222
19년 전 조회 2,003
19년 전 조회 3,283
19년 전 조회 2,120
19년 전 조회 2,793
19년 전 조회 1,745
19년 전 조회 5,319
19년 전 조회 3,564
19년 전 조회 4,315
19년 전 조회 3,063
19년 전 조회 2,531
19년 전 조회 3,930
19년 전 조회 2,651
19년 전 조회 2,992
19년 전 조회 2,958
19년 전 조회 4,179
19년 전 조회 3,128
19년 전 조회 3,027
19년 전 조회 3,679
19년 전 조회 2,980
19년 전 조회 2,208
19년 전 조회 2,228
19년 전 조회 2,167
19년 전 조회 2,771
19년 전 조회 2,486
19년 전 조회 3,349
19년 전 조회 3,201
19년 전 조회 1,827
19년 전 조회 2,742
19년 전 조회 7,831
19년 전 조회 2,505
19년 전 조회 3,116
19년 전 조회 2,863
19년 전 조회 3,019
19년 전 조회 2,224
19년 전 조회 2,454
19년 전 조회 4,075
19년 전 조회 2,229
19년 전 조회 4,232
19년 전 조회 2,389
19년 전 조회 2,081
19년 전 조회 2,332
19년 전 조회 1,874
19년 전 조회 2,408
19년 전 조회 2,201
19년 전 조회 3,070
19년 전 조회 1,855
19년 전 조회 3,550
19년 전 조회 2,703
19년 전 조회 3,450
19년 전 조회 3,452
19년 전 조회 3,153
19년 전 조회 5,441
19년 전 조회 2,171
19년 전 조회 2,222
19년 전 조회 2,316
19년 전 조회 3,397
19년 전 조회 3,707
19년 전 조회 3,750
19년 전 조회 2,355