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,979
19년 전 조회 2,118
19년 전 조회 1,671
19년 전 조회 2,366
19년 전 조회 2,015
19년 전 조회 1,629
19년 전 조회 1,806
19년 전 조회 2,069
19년 전 조회 1,821
19년 전 조회 1,614
19년 전 조회 1,678
19년 전 조회 3,156
19년 전 조회 2,023
19년 전 조회 1,887
19년 전 조회 4,386
19년 전 조회 5,016
19년 전 조회 3,183
19년 전 조회 2,915
19년 전 조회 3,522
19년 전 조회 2,061
19년 전 조회 2,418
19년 전 조회 2,708
19년 전 조회 2,786
19년 전 조회 2,383
19년 전 조회 1,642
19년 전 조회 3,405
19년 전 조회 2,001
19년 전 조회 2,408
19년 전 조회 2,470
19년 전 조회 2,903
19년 전 조회 5,232
19년 전 조회 2,505
19년 전 조회 3,350
19년 전 조회 4,290
19년 전 조회 2,528
19년 전 조회 2,484
19년 전 조회 4,066
19년 전 조회 2,774
19년 전 조회 3,015
19년 전 조회 2,232
19년 전 조회 2,242
19년 전 조회 2,025
19년 전 조회 3,312
19년 전 조회 2,143
19년 전 조회 2,816
19년 전 조회 1,771
19년 전 조회 5,338
19년 전 조회 3,581
19년 전 조회 4,336
19년 전 조회 3,080
19년 전 조회 2,555
19년 전 조회 3,946
19년 전 조회 2,667
19년 전 조회 3,011
19년 전 조회 2,976
19년 전 조회 4,196
19년 전 조회 3,153
19년 전 조회 3,039
19년 전 조회 3,709
19년 전 조회 3,010
19년 전 조회 2,237
19년 전 조회 2,250
19년 전 조회 2,194
19년 전 조회 2,791
19년 전 조회 2,507
19년 전 조회 3,368
19년 전 조회 3,212
19년 전 조회 1,843
19년 전 조회 2,758
19년 전 조회 7,861
19년 전 조회 2,530
19년 전 조회 3,136
19년 전 조회 2,887
19년 전 조회 3,039
19년 전 조회 2,246
19년 전 조회 2,469
19년 전 조회 4,092
19년 전 조회 2,251
19년 전 조회 4,249
19년 전 조회 2,410
19년 전 조회 2,104
19년 전 조회 2,350
19년 전 조회 1,899
19년 전 조회 2,430
19년 전 조회 2,223
19년 전 조회 3,093
19년 전 조회 1,878
19년 전 조회 3,560
19년 전 조회 2,728
19년 전 조회 3,465
19년 전 조회 3,471
19년 전 조회 3,169
19년 전 조회 5,459
19년 전 조회 2,191
19년 전 조회 2,240
19년 전 조회 2,336
19년 전 조회 3,417
19년 전 조회 3,727
19년 전 조회 3,767
19년 전 조회 2,374