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,122
19년 전 조회 2,280
19년 전 조회 1,830
19년 전 조회 2,517
19년 전 조회 2,159
19년 전 조회 1,771
19년 전 조회 1,962
19년 전 조회 2,213
19년 전 조회 1,983
19년 전 조회 1,768
19년 전 조회 1,830
19년 전 조회 3,327
19년 전 조회 2,178
19년 전 조회 2,037
19년 전 조회 4,533
19년 전 조회 5,160
19년 전 조회 3,335
19년 전 조회 3,068
19년 전 조회 3,668
19년 전 조회 2,204
19년 전 조회 2,567
19년 전 조회 2,868
19년 전 조회 2,932
19년 전 조회 2,542
19년 전 조회 1,800
19년 전 조회 3,587
19년 전 조회 2,164
19년 전 조회 2,559
19년 전 조회 2,624
19년 전 조회 3,059
19년 전 조회 5,382
19년 전 조회 2,660
19년 전 조회 3,501
19년 전 조회 4,437
19년 전 조회 2,693
19년 전 조회 2,628
19년 전 조회 4,225
19년 전 조회 2,926
19년 전 조회 3,157
19년 전 조회 2,381
19년 전 조회 2,385
19년 전 조회 2,176
19년 전 조회 3,471
19년 전 조회 2,282
19년 전 조회 2,970
19년 전 조회 1,920
19년 전 조회 5,473
19년 전 조회 3,747
19년 전 조회 4,491
19년 전 조회 3,237
19년 전 조회 2,700
19년 전 조회 4,092
19년 전 조회 2,821
19년 전 조회 3,167
19년 전 조회 3,136
19년 전 조회 4,348
19년 전 조회 3,302
19년 전 조회 3,190
19년 전 조회 3,876
19년 전 조회 3,165
19년 전 조회 2,399
19년 전 조회 2,400
19년 전 조회 2,339
19년 전 조회 2,962
19년 전 조회 2,664
19년 전 조회 3,509
19년 전 조회 3,378
19년 전 조회 1,995
19년 전 조회 2,923
19년 전 조회 8,002
19년 전 조회 2,684
19년 전 조회 3,287
19년 전 조회 3,054
19년 전 조회 3,172
19년 전 조회 2,402
19년 전 조회 2,630
19년 전 조회 4,226
19년 전 조회 2,427
19년 전 조회 4,405
19년 전 조회 2,575
19년 전 조회 2,255
19년 전 조회 2,497
19년 전 조회 2,050
19년 전 조회 2,585
19년 전 조회 2,368
19년 전 조회 3,245
19년 전 조회 2,024
19년 전 조회 3,699
19년 전 조회 2,877
19년 전 조회 3,599
19년 전 조회 3,628
19년 전 조회 3,327
19년 전 조회 5,603
19년 전 조회 2,348
19년 전 조회 2,386
19년 전 조회 2,495
19년 전 조회 3,568
19년 전 조회 3,886
19년 전 조회 3,906
19년 전 조회 2,524