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,942
19년 전 조회 2,085
19년 전 조회 1,620
19년 전 조회 2,327
19년 전 조회 1,980
19년 전 조회 1,592
19년 전 조회 1,774
19년 전 조회 2,027
19년 전 조회 1,778
19년 전 조회 1,583
19년 전 조회 1,645
19년 전 조회 3,112
19년 전 조회 1,983
19년 전 조회 1,854
19년 전 조회 4,355
19년 전 조회 4,983
19년 전 조회 3,145
19년 전 조회 2,877
19년 전 조회 3,480
19년 전 조회 2,027
19년 전 조회 2,378
19년 전 조회 2,675
19년 전 조회 2,749
19년 전 조회 2,340
19년 전 조회 1,602
19년 전 조회 3,370
19년 전 조회 1,964
19년 전 조회 2,373
19년 전 조회 2,438
19년 전 조회 2,864
19년 전 조회 5,195
19년 전 조회 2,477
19년 전 조회 3,317
19년 전 조회 4,257
19년 전 조회 2,492
19년 전 조회 2,451
19년 전 조회 4,015
19년 전 조회 2,734
19년 전 조회 2,981
19년 전 조회 2,191
19년 전 조회 2,209
19년 전 조회 1,989
19년 전 조회 3,270
19년 전 조회 2,104
19년 전 조회 2,779
19년 전 조회 1,734
19년 전 조회 5,303
19년 전 조회 3,551
19년 전 조회 4,301
19년 전 조회 3,049
19년 전 조회 2,515
19년 전 조회 3,916
19년 전 조회 2,638
19년 전 조회 2,977
19년 전 조회 2,944
19년 전 조회 4,166
19년 전 조회 3,113
19년 전 조회 3,012
19년 전 조회 3,666
19년 전 조회 2,967
19년 전 조회 2,192
19년 전 조회 2,215
19년 전 조회 2,156
19년 전 조회 2,761
19년 전 조회 2,471
19년 전 조회 3,335
19년 전 조회 3,187
19년 전 조회 1,816
19년 전 조회 2,729
19년 전 조회 7,817
19년 전 조회 2,490
19년 전 조회 3,097
19년 전 조회 2,847
19년 전 조회 3,004
19년 전 조회 2,209
19년 전 조회 2,440
19년 전 조회 4,063
19년 전 조회 2,219
19년 전 조회 4,216
19년 전 조회 2,375
19년 전 조회 2,070
19년 전 조회 2,319
19년 전 조회 1,860
19년 전 조회 2,397
19년 전 조회 2,187
19년 전 조회 3,057
19년 전 조회 1,841
19년 전 조회 3,534
19년 전 조회 2,690
19년 전 조회 3,436
19년 전 조회 3,437
19년 전 조회 3,139
19년 전 조회 5,427
19년 전 조회 2,159
19년 전 조회 2,208
19년 전 조회 2,305
19년 전 조회 3,384
19년 전 조회 3,691
19년 전 조회 3,736
19년 전 조회 2,342
🐛 버그신고