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,025
19년 전 조회 2,155
19년 전 조회 1,716
19년 전 조회 2,400
19년 전 조회 2,044
19년 전 조회 1,668
19년 전 조회 1,846
19년 전 조회 2,101
19년 전 조회 1,875
19년 전 조회 1,650
19년 전 조회 1,711
19년 전 조회 3,214
19년 전 조회 2,060
19년 전 조회 1,920
19년 전 조회 4,427
19년 전 조회 5,050
19년 전 조회 3,217
19년 전 조회 2,953
19년 전 조회 3,558
19년 전 조회 2,095
19년 전 조회 2,458
19년 전 조회 2,743
19년 전 조회 2,824
19년 전 조회 2,426
19년 전 조회 1,686
19년 전 조회 3,450
19년 전 조회 2,035
19년 전 조회 2,448
19년 전 조회 2,513
19년 전 조회 2,948
19년 전 조회 5,284
19년 전 조회 2,534
19년 전 조회 3,381
19년 전 조회 4,323
19년 전 조회 2,572
19년 전 조회 2,517
19년 전 조회 4,108
19년 전 조회 2,798
19년 전 조회 3,042
19년 전 조회 2,274
19년 전 조회 2,287
19년 전 조회 2,063
19년 전 조회 3,355
19년 전 조회 2,179
19년 전 조회 2,855
19년 전 조회 1,813
19년 전 조회 5,368
19년 전 조회 3,621
19년 전 조회 4,373
19년 전 조회 3,108
19년 전 조회 2,597
19년 전 조회 3,982
19년 전 조회 2,700
19년 전 조회 3,052
19년 전 조회 3,018
19년 전 조회 4,229
19년 전 조회 3,197
19년 전 조회 3,078
19년 전 조회 3,754
19년 전 조회 3,064
19년 전 조회 2,280
19년 전 조회 2,295
19년 전 조회 2,236
19년 전 조회 2,844
19년 전 조회 2,541
19년 전 조회 3,404
19년 전 조회 3,259
19년 전 조회 1,875
19년 전 조회 2,803
19년 전 조회 7,899
19년 전 조회 2,579
19년 전 조회 3,172
19년 전 조회 2,937
19년 전 조회 3,081
19년 전 조회 2,275
19년 전 조회 2,518
19년 전 조회 4,127
19년 전 조회 2,306
19년 전 조회 4,286
19년 전 조회 2,456
19년 전 조회 2,136
19년 전 조회 2,378
19년 전 조회 1,947
19년 전 조회 2,469
19년 전 조회 2,255
19년 전 조회 3,129
19년 전 조회 1,920
19년 전 조회 3,591
19년 전 조회 2,769
19년 전 조회 3,492
19년 전 조회 3,502
19년 전 조회 3,203
19년 전 조회 5,496
19년 전 조회 2,238
19년 전 조회 2,278
19년 전 조회 2,385
19년 전 조회 3,457
19년 전 조회 3,758
19년 전 조회 3,796
19년 전 조회 2,410