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,091
19년 전 조회 2,241
19년 전 조회 1,801
19년 전 조회 2,484
19년 전 조회 2,129
19년 전 조회 1,738
19년 전 조회 1,926
19년 전 조회 2,183
19년 전 조회 1,949
19년 전 조회 1,736
19년 전 조회 1,792
19년 전 조회 3,293
19년 전 조회 2,145
19년 전 조회 2,009
19년 전 조회 4,509
19년 전 조회 5,131
19년 전 조회 3,305
19년 전 조회 3,043
19년 전 조회 3,639
19년 전 조회 2,174
19년 전 조회 2,537
19년 전 조회 2,830
19년 전 조회 2,901
19년 전 조회 2,503
19년 전 조회 1,764
19년 전 조회 3,556
19년 전 조회 2,119
19년 전 조회 2,529
19년 전 조회 2,587
19년 전 조회 3,028
19년 전 조회 5,356
19년 전 조회 2,628
19년 전 조회 3,472
19년 전 조회 4,396
19년 전 조회 2,664
19년 전 조회 2,607
19년 전 조회 4,195
19년 전 조회 2,893
19년 전 조회 3,124
19년 전 조회 2,358
19년 전 조회 2,357
19년 전 조회 2,143
19년 전 조회 3,436
19년 전 조회 2,250
19년 전 조회 2,938
19년 전 조회 1,891
19년 전 조회 5,447
19년 전 조회 3,705
19년 전 조회 4,463
19년 전 조회 3,201
19년 전 조회 2,679
19년 전 조회 4,063
19년 전 조회 2,789
19년 전 조회 3,139
19년 전 조회 3,107
19년 전 조회 4,309
19년 전 조회 3,268
19년 전 조회 3,156
19년 전 조회 3,845
19년 전 조회 3,135
19년 전 조회 2,369
19년 전 조회 2,363
19년 전 조회 2,309
19년 전 조회 2,930
19년 전 조회 2,628
19년 전 조회 3,479
19년 전 조회 3,341
19년 전 조회 1,964
19년 전 조회 2,892
19년 전 조회 7,971
19년 전 조회 2,652
19년 전 조회 3,260
19년 전 조회 3,024
19년 전 조회 3,139
19년 전 조회 2,370
19년 전 조회 2,602
19년 전 조회 4,199
19년 전 조회 2,392
19년 전 조회 4,377
19년 전 조회 2,550
19년 전 조회 2,229
19년 전 조회 2,462
19년 전 조회 2,024
19년 전 조회 2,547
19년 전 조회 2,336
19년 전 조회 3,211
19년 전 조회 1,996
19년 전 조회 3,670
19년 전 조회 2,848
19년 전 조회 3,572
19년 전 조회 3,596
19년 전 조회 3,297
19년 전 조회 5,578
19년 전 조회 2,318
19년 전 조회 2,356
19년 전 조회 2,467
19년 전 조회 3,538
19년 전 조회 3,857
19년 전 조회 3,879
19년 전 조회 2,490