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,155
19년 전 조회 2,302
19년 전 조회 1,862
19년 전 조회 2,545
19년 전 조회 2,189
19년 전 조회 1,797
19년 전 조회 1,990
19년 전 조회 2,253
19년 전 조회 2,011
19년 전 조회 1,801
19년 전 조회 1,860
19년 전 조회 3,354
19년 전 조회 2,210
19년 전 조회 2,070
19년 전 조회 4,564
19년 전 조회 5,189
19년 전 조회 3,359
19년 전 조회 3,096
19년 전 조회 3,698
19년 전 조회 2,240
19년 전 조회 2,598
19년 전 조회 2,896
19년 전 조회 2,966
19년 전 조회 2,557
19년 전 조회 1,828
19년 전 조회 3,617
19년 전 조회 2,183
19년 전 조회 2,589
19년 전 조회 2,656
19년 전 조회 3,084
19년 전 조회 5,411
19년 전 조회 2,691
19년 전 조회 3,524
19년 전 조회 4,460
19년 전 조회 2,724
19년 전 조회 2,666
19년 전 조회 4,256
19년 전 조회 2,953
19년 전 조회 3,190
19년 전 조회 2,411
19년 전 조회 2,412
19년 전 조회 2,204
19년 전 조회 3,502
19년 전 조회 2,310
19년 전 조회 2,997
19년 전 조회 1,943
19년 전 조회 5,507
19년 전 조회 3,772
19년 전 조회 4,517
19년 전 조회 3,264
19년 전 조회 2,734
19년 전 조회 4,127
19년 전 조회 2,845
19년 전 조회 3,188
19년 전 조회 3,160
19년 전 조회 4,375
19년 전 조회 3,324
19년 전 조회 3,213
19년 전 조회 3,903
19년 전 조회 3,188
19년 전 조회 2,423
19년 전 조회 2,431
19년 전 조회 2,374
19년 전 조회 2,996
19년 전 조회 2,697
19년 전 조회 3,541
19년 전 조회 3,411
19년 전 조회 2,017
19년 전 조회 2,954
19년 전 조회 8,035
19년 전 조회 2,713
19년 전 조회 3,318
19년 전 조회 3,083
19년 전 조회 3,192
19년 전 조회 2,435
19년 전 조회 2,659
19년 전 조회 4,263
19년 전 조회 2,452
19년 전 조회 4,439
19년 전 조회 2,603
19년 전 조회 2,287
19년 전 조회 2,521
19년 전 조회 2,079
19년 전 조회 2,618
19년 전 조회 2,392
19년 전 조회 3,272
19년 전 조회 2,048
19년 전 조회 3,728
19년 전 조회 2,902
19년 전 조회 3,627
19년 전 조회 3,653
19년 전 조회 3,345
19년 전 조회 5,634
19년 전 조회 2,372
19년 전 조회 2,414
19년 전 조회 2,520
19년 전 조회 3,592
19년 전 조회 3,912
19년 전 조회 3,937
19년 전 조회 2,557