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,954
19년 전 조회 2,098
19년 전 조회 1,635
19년 전 조회 2,339
19년 전 조회 1,995
19년 전 조회 1,605
19년 전 조회 1,784
19년 전 조회 2,040
19년 전 조회 1,788
19년 전 조회 1,593
19년 전 조회 1,657
19년 전 조회 3,127
19년 전 조회 1,995
19년 전 조회 1,868
19년 전 조회 4,368
19년 전 조회 4,995
19년 전 조회 3,157
19년 전 조회 2,891
19년 전 조회 3,496
19년 전 조회 2,040
19년 전 조회 2,392
19년 전 조회 2,686
19년 전 조회 2,762
19년 전 조회 2,348
19년 전 조회 1,611
19년 전 조회 3,377
19년 전 조회 1,975
19년 전 조회 2,390
19년 전 조회 2,449
19년 전 조회 2,873
19년 전 조회 5,202
19년 전 조회 2,483
19년 전 조회 3,326
19년 전 조회 4,265
19년 전 조회 2,508
19년 전 조회 2,460
19년 전 조회 4,031
19년 전 조회 2,748
19년 전 조회 2,993
19년 전 조회 2,205
19년 전 조회 2,221
19년 전 조회 2,001
19년 전 조회 3,281
19년 전 조회 2,115
19년 전 조회 2,790
19년 전 조회 1,744
19년 전 조회 5,317
19년 전 조회 3,562
19년 전 조회 4,315
19년 전 조회 3,062
19년 전 조회 2,528
19년 전 조회 3,927
19년 전 조회 2,649
19년 전 조회 2,990
19년 전 조회 2,957
19년 전 조회 4,179
19년 전 조회 3,123
19년 전 조회 3,025
19년 전 조회 3,678
19년 전 조회 2,976
19년 전 조회 2,208
19년 전 조회 2,225
19년 전 조회 2,166
19년 전 조회 2,770
19년 전 조회 2,485
19년 전 조회 3,348
19년 전 조회 3,198
19년 전 조회 1,826
19년 전 조회 2,741
19년 전 조회 7,828
19년 전 조회 2,500
19년 전 조회 3,112
19년 전 조회 2,861
19년 전 조회 3,018
19년 전 조회 2,222
19년 전 조회 2,452
19년 전 조회 4,075
19년 전 조회 2,225
19년 전 조회 4,229
19년 전 조회 2,387
19년 전 조회 2,079
19년 전 조회 2,330
19년 전 조회 1,873
19년 전 조회 2,406
19년 전 조회 2,198
19년 전 조회 3,069
19년 전 조회 1,853
19년 전 조회 3,545
19년 전 조회 2,702
19년 전 조회 3,447
19년 전 조회 3,451
19년 전 조회 3,150
19년 전 조회 5,439
19년 전 조회 2,169
19년 전 조회 2,221
19년 전 조회 2,315
19년 전 조회 3,393
19년 전 조회 3,704
19년 전 조회 3,748
19년 전 조회 2,353