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,059
19년 전 조회 2,197
19년 전 조회 1,753
19년 전 조회 2,447
19년 전 조회 2,090
19년 전 조회 1,713
19년 전 조회 1,891
19년 전 조회 2,145
19년 전 조회 1,912
19년 전 조회 1,691
19년 전 조회 1,754
19년 전 조회 3,258
19년 전 조회 2,108
19년 전 조회 1,971
19년 전 조회 4,470
19년 전 조회 5,097
19년 전 조회 3,267
19년 전 조회 2,996
19년 전 조회 3,602
19년 전 조회 2,146
19년 전 조회 2,507
19년 전 조회 2,789
19년 전 조회 2,867
19년 전 조회 2,467
19년 전 조회 1,731
19년 전 조회 3,506
19년 전 조회 2,081
19년 전 조회 2,488
19년 전 조회 2,554
19년 전 조회 2,992
19년 전 조회 5,316
19년 전 조회 2,586
19년 전 조회 3,421
19년 전 조회 4,367
19년 전 조회 2,610
19년 전 조회 2,556
19년 전 조회 4,144
19년 전 조회 2,847
19년 전 조회 3,084
19년 전 조회 2,308
19년 전 조회 2,320
19년 전 조회 2,106
19년 전 조회 3,401
19년 전 조회 2,220
19년 전 조회 2,904
19년 전 조회 1,850
19년 전 조회 5,407
19년 전 조회 3,663
19년 전 조회 4,421
19년 전 조회 3,166
19년 전 조회 2,631
19년 전 조회 4,020
19년 전 조회 2,753
19년 전 조회 3,088
19년 전 조회 3,069
19년 전 조회 4,273
19년 전 조회 3,236
19년 전 조회 3,115
19년 전 조회 3,803
19년 전 조회 3,097
19년 전 조회 2,323
19년 전 조회 2,327
19년 전 조회 2,272
19년 전 조회 2,884
19년 전 조회 2,579
19년 전 조회 3,448
19년 전 조회 3,304
19년 전 조회 1,928
19년 전 조회 2,847
19년 전 조회 7,933
19년 전 조회 2,610
19년 전 조회 3,219
19년 전 조회 2,979
19년 전 조회 3,111
19년 전 조회 2,315
19년 전 조회 2,556
19년 전 조회 4,161
19년 전 조회 2,347
19년 전 조회 4,331
19년 전 조회 2,500
19년 전 조회 2,187
19년 전 조회 2,424
19년 전 조회 1,982
19년 전 조회 2,513
19년 전 조회 2,298
19년 전 조회 3,173
19년 전 조회 1,963
19년 전 조회 3,640
19년 전 조회 2,814
19년 전 조회 3,530
19년 전 조회 3,554
19년 전 조회 3,250
19년 전 조회 5,540
19년 전 조회 2,275
19년 전 조회 2,326
19년 전 조회 2,434
19년 전 조회 3,499
19년 전 조회 3,809
19년 전 조회 3,835
19년 전 조회 2,455