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,171
19년 전 조회 2,318
19년 전 조회 1,873
19년 전 조회 2,565
19년 전 조회 2,205
19년 전 조회 1,814
19년 전 조회 2,008
19년 전 조회 2,272
19년 전 조회 2,023
19년 전 조회 1,813
19년 전 조회 1,881
19년 전 조회 3,370
19년 전 조회 2,230
19년 전 조회 2,087
19년 전 조회 4,580
19년 전 조회 5,202
19년 전 조회 3,373
19년 전 조회 3,113
19년 전 조회 3,706
19년 전 조회 2,253
19년 전 조회 2,611
19년 전 조회 2,916
19년 전 조회 2,982
19년 전 조회 2,577
19년 전 조회 1,843
19년 전 조회 3,628
19년 전 조회 2,207
19년 전 조회 2,608
19년 전 조회 2,675
19년 전 조회 3,105
19년 전 조회 5,429
19년 전 조회 2,712
19년 전 조회 3,538
19년 전 조회 4,476
19년 전 조회 2,738
19년 전 조회 2,677
19년 전 조회 4,266
19년 전 조회 2,966
19년 전 조회 3,205
19년 전 조회 2,423
19년 전 조회 2,429
19년 전 조회 2,217
19년 전 조회 3,517
19년 전 조회 2,329
19년 전 조회 3,017
19년 전 조회 1,958
19년 전 조회 5,523
19년 전 조회 3,788
19년 전 조회 4,532
19년 전 조회 3,280
19년 전 조회 2,753
19년 전 조회 4,152
19년 전 조회 2,865
19년 전 조회 3,208
19년 전 조회 3,181
19년 전 조회 4,391
19년 전 조회 3,336
19년 전 조회 3,228
19년 전 조회 3,914
19년 전 조회 3,205
19년 전 조회 2,438
19년 전 조회 2,442
19년 전 조회 2,386
19년 전 조회 3,008
19년 전 조회 2,710
19년 전 조회 3,562
19년 전 조회 3,428
19년 전 조회 2,031
19년 전 조회 2,964
19년 전 조회 8,048
19년 전 조회 2,729
19년 전 조회 3,336
19년 전 조회 3,099
19년 전 조회 3,201
19년 전 조회 2,449
19년 전 조회 2,675
19년 전 조회 4,278
19년 전 조회 2,467
19년 전 조회 4,457
19년 전 조회 2,615
19년 전 조회 2,296
19년 전 조회 2,541
19년 전 조회 2,098
19년 전 조회 2,628
19년 전 조회 2,417
19년 전 조회 3,285
19년 전 조회 2,064
19년 전 조회 3,740
19년 전 조회 2,918
19년 전 조회 3,638
19년 전 조회 3,669
19년 전 조회 3,365
19년 전 조회 5,656
19년 전 조회 2,389
19년 전 조회 2,433
19년 전 조회 2,535
19년 전 조회 3,608
19년 전 조회 3,937
19년 전 조회 3,958
19년 전 조회 2,575