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,952
19년 전 조회 2,095
19년 전 조회 1,630
19년 전 조회 2,337
19년 전 조회 1,992
19년 전 조회 1,601
19년 전 조회 1,783
19년 전 조회 2,036
19년 전 조회 1,785
19년 전 조회 1,589
19년 전 조회 1,655
19년 전 조회 3,123
19년 전 조회 1,992
19년 전 조회 1,863
19년 전 조회 4,364
19년 전 조회 4,995
19년 전 조회 3,156
19년 전 조회 2,888
19년 전 조회 3,491
19년 전 조회 2,037
19년 전 조회 2,388
19년 전 조회 2,685
19년 전 조회 2,759
19년 전 조회 2,346
19년 전 조회 1,609
19년 전 조회 3,376
19년 전 조회 1,974
19년 전 조회 2,385
19년 전 조회 2,447
19년 전 조회 2,872
19년 전 조회 5,201
19년 전 조회 2,482
19년 전 조회 3,324
19년 전 조회 4,264
19년 전 조회 2,502
19년 전 조회 2,456
19년 전 조회 4,025
19년 전 조회 2,744
19년 전 조회 2,990
19년 전 조회 2,200
19년 전 조회 2,219
19년 전 조회 1,998
19년 전 조회 3,278
19년 전 조회 2,112
19년 전 조회 2,787
19년 전 조회 1,743
19년 전 조회 5,312
19년 전 조회 3,561
19년 전 조회 4,312
19년 전 조회 3,059
19년 전 조회 2,524
19년 전 조회 3,923
19년 전 조회 2,647
19년 전 조회 2,988
19년 전 조회 2,951
19년 전 조회 4,174
19년 전 조회 3,120
19년 전 조회 3,021
19년 전 조회 3,676
19년 전 조회 2,974
19년 전 조회 2,202
19년 전 조회 2,224
19년 전 조회 2,163
19년 전 조회 2,769
19년 전 조회 2,482
19년 전 조회 3,345
19년 전 조회 3,197
19년 전 조회 1,824
19년 전 조회 2,738
19년 전 조회 7,826
19년 전 조회 2,498
19년 전 조회 3,108
19년 전 조회 2,856
19년 전 조회 3,014
19년 전 조회 2,217
19년 전 조회 2,449
19년 전 조회 4,073
19년 전 조회 2,223
19년 전 조회 4,225
19년 전 조회 2,383
19년 전 조회 2,078
19년 전 조회 2,328
19년 전 조회 1,869
19년 전 조회 2,406
19년 전 조회 2,195
19년 전 조회 3,066
19년 전 조회 1,848
19년 전 조회 3,544
19년 전 조회 2,698
19년 전 조회 3,444
19년 전 조회 3,447
19년 전 조회 3,146
19년 전 조회 5,436
19년 전 조회 2,165
19년 전 조회 2,218
19년 전 조회 2,312
19년 전 조회 3,391
19년 전 조회 3,699
19년 전 조회 3,745
19년 전 조회 2,352
🐛 버그신고