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,961
19년 전 조회 2,105
19년 전 조회 1,642
19년 전 조회 2,345
19년 전 조회 2,001
19년 전 조회 1,610
19년 전 조회 1,793
19년 전 조회 2,048
19년 전 조회 1,794
19년 전 조회 1,600
19년 전 조회 1,662
19년 전 조회 3,131
19년 전 조회 2,004
19년 전 조회 1,874
19년 전 조회 4,376
19년 전 조회 5,001
19년 전 조회 3,166
19년 전 조회 2,899
19년 전 조회 3,502
19년 전 조회 2,048
19년 전 조회 2,394
19년 전 조회 2,689
19년 전 조회 2,771
19년 전 조회 2,355
19년 전 조회 1,619
19년 전 조회 3,385
19년 전 조회 1,984
19년 전 조회 2,397
19년 전 조회 2,460
19년 전 조회 2,880
19년 전 조회 5,209
19년 전 조회 2,492
19년 전 조회 3,335
19년 전 조회 4,276
19년 전 조회 2,512
19년 전 조회 2,467
19년 전 조회 4,037
19년 전 조회 2,755
19년 전 조회 2,997
19년 전 조회 2,213
19년 전 조회 2,225
19년 전 조회 2,005
19년 전 조회 3,287
19년 전 조회 2,124
19년 전 조회 2,799
19년 전 조회 1,751
19년 전 조회 5,322
19년 전 조회 3,567
19년 전 조회 4,318
19년 전 조회 3,067
19년 전 조회 2,533
19년 전 조회 3,934
19년 전 조회 2,655
19년 전 조회 2,998
19년 전 조회 2,960
19년 전 조회 4,186
19년 전 조회 3,130
19년 전 조회 3,030
19년 전 조회 3,683
19년 전 조회 2,989
19년 전 조회 2,216
19년 전 조회 2,229
19년 전 조회 2,173
19년 전 조회 2,774
19년 전 조회 2,490
19년 전 조회 3,352
19년 전 조회 3,204
19년 전 조회 1,830
19년 전 조회 2,742
19년 전 조회 7,837
19년 전 조회 2,512
19년 전 조회 3,119
19년 전 조회 2,868
19년 전 조회 3,020
19년 전 조회 2,230
19년 전 조회 2,456
19년 전 조회 4,080
19년 전 조회 2,233
19년 전 조회 4,235
19년 전 조회 2,392
19년 전 조회 2,086
19년 전 조회 2,337
19년 전 조회 1,879
19년 전 조회 2,409
19년 전 조회 2,204
19년 전 조회 3,073
19년 전 조회 1,857
19년 전 조회 3,553
19년 전 조회 2,707
19년 전 조회 3,452
19년 전 조회 3,454
19년 전 조회 3,156
19년 전 조회 5,442
19년 전 조회 2,173
19년 전 조회 2,226
19년 전 조회 2,318
19년 전 조회 3,401
19년 전 조회 3,709
19년 전 조회 3,757
19년 전 조회 2,357