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,944
19년 전 조회 2,086
19년 전 조회 1,621
19년 전 조회 2,328
19년 전 조회 1,982
19년 전 조회 1,592
19년 전 조회 1,775
19년 전 조회 2,029
19년 전 조회 1,779
19년 전 조회 1,583
19년 전 조회 1,646
19년 전 조회 3,114
19년 전 조회 1,984
19년 전 조회 1,855
19년 전 조회 4,357
19년 전 조회 4,983
19년 전 조회 3,146
19년 전 조회 2,878
19년 전 조회 3,482
19년 전 조회 2,028
19년 전 조회 2,378
19년 전 조회 2,675
19년 전 조회 2,750
19년 전 조회 2,340
19년 전 조회 1,604
19년 전 조회 3,372
19년 전 조회 1,965
19년 전 조회 2,374
19년 전 조회 2,441
19년 전 조회 2,865
19년 전 조회 5,196
19년 전 조회 2,477
19년 전 조회 3,318
19년 전 조회 4,258
19년 전 조회 2,493
19년 전 조회 2,452
19년 전 조회 4,018
19년 전 조회 2,735
19년 전 조회 2,983
19년 전 조회 2,191
19년 전 조회 2,210
19년 전 조회 1,990
19년 전 조회 3,272
19년 전 조회 2,105
19년 전 조회 2,780
19년 전 조회 1,736
19년 전 조회 5,304
19년 전 조회 3,553
19년 전 조회 4,302
19년 전 조회 3,051
19년 전 조회 2,517
19년 전 조회 3,916
19년 전 조회 2,639
19년 전 조회 2,977
19년 전 조회 2,946
19년 전 조회 4,167
19년 전 조회 3,114
19년 전 조회 3,013
19년 전 조회 3,668
19년 전 조회 2,967
19년 전 조회 2,194
19년 전 조회 2,217
19년 전 조회 2,156
19년 전 조회 2,762
19년 전 조회 2,472
19년 전 조회 3,336
19년 전 조회 3,187
19년 전 조회 1,817
19년 전 조회 2,729
19년 전 조회 7,819
19년 전 조회 2,490
19년 전 조회 3,099
19년 전 조회 2,847
19년 전 조회 3,005
19년 전 조회 2,212
19년 전 조회 2,442
19년 전 조회 4,064
19년 전 조회 2,219
19년 전 조회 4,216
19년 전 조회 2,376
19년 전 조회 2,071
19년 전 조회 2,319
19년 전 조회 1,861
19년 전 조회 2,399
19년 전 조회 2,189
19년 전 조회 3,058
19년 전 조회 1,842
19년 전 조회 3,536
19년 전 조회 2,692
19년 전 조회 3,436
19년 전 조회 3,438
19년 전 조회 3,141
19년 전 조회 5,428
19년 전 조회 2,161
19년 전 조회 2,209
19년 전 조회 2,306
19년 전 조회 3,385
19년 전 조회 3,692
19년 전 조회 3,738
19년 전 조회 2,343
🐛 버그신고