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,959
19년 전 조회 2,101
19년 전 조회 1,639
19년 전 조회 2,343
19년 전 조회 2,000
19년 전 조회 1,608
19년 전 조회 1,787
19년 전 조회 2,043
19년 전 조회 1,793
19년 전 조회 1,597
19년 전 조회 1,660
19년 전 조회 3,129
19년 전 조회 1,998
19년 전 조회 1,872
19년 전 조회 4,372
19년 전 조회 4,998
19년 전 조회 3,162
19년 전 조회 2,892
19년 전 조회 3,499
19년 전 조회 2,044
19년 전 조회 2,394
19년 전 조회 2,689
19년 전 조회 2,767
19년 전 조회 2,355
19년 전 조회 1,615
19년 전 조회 3,385
19년 전 조회 1,980
19년 전 조회 2,393
19년 전 조회 2,454
19년 전 조회 2,876
19년 전 조회 5,207
19년 전 조회 2,490
19년 전 조회 3,330
19년 전 조회 4,274
19년 전 조회 2,511
19년 전 조회 2,465
19년 전 조회 4,035
19년 전 조회 2,750
19년 전 조회 2,994
19년 전 조회 2,209
19년 전 조회 2,223
19년 전 조회 2,004
19년 전 조회 3,285
19년 전 조회 2,122
19년 전 조회 2,795
19년 전 조회 1,746
19년 전 조회 5,319
19년 전 조회 3,565
19년 전 조회 4,317
19년 전 조회 3,064
19년 전 조회 2,532
19년 전 조회 3,930
19년 전 조회 2,653
19년 전 조회 2,994
19년 전 조회 2,960
19년 전 조회 4,181
19년 전 조회 3,129
19년 전 조회 3,027
19년 전 조회 3,680
19년 전 조회 2,982
19년 전 조회 2,211
19년 전 조회 2,228
19년 전 조회 2,167
19년 전 조회 2,772
19년 전 조회 2,489
19년 전 조회 3,350
19년 전 조회 3,201
19년 전 조회 1,829
19년 전 조회 2,742
19년 전 조회 7,832
19년 전 조회 2,505
19년 전 조회 3,116
19년 전 조회 2,863
19년 전 조회 3,019
19년 전 조회 2,225
19년 전 조회 2,454
19년 전 조회 4,076
19년 전 조회 2,230
19년 전 조회 4,232
19년 전 조회 2,390
19년 전 조회 2,083
19년 전 조회 2,332
19년 전 조회 1,874
19년 전 조회 2,408
19년 전 조회 2,202
19년 전 조회 3,072
19년 전 조회 1,855
19년 전 조회 3,552
19년 전 조회 2,705
19년 전 조회 3,450
19년 전 조회 3,452
19년 전 조회 3,155
19년 전 조회 5,441
19년 전 조회 2,172
19년 전 조회 2,222
19년 전 조회 2,316
19년 전 조회 3,397
19년 전 조회 3,707
19년 전 조회 3,751
19년 전 조회 2,355