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,973
19년 전 조회 2,117
19년 전 조회 1,657
19년 전 조회 2,358
19년 전 조회 2,010
19년 전 조회 1,622
19년 전 조회 1,804
19년 전 조회 2,064
19년 전 조회 1,810
19년 전 조회 1,609
19년 전 조회 1,675
19년 전 조회 3,143
19년 전 조회 2,011
19년 전 조회 1,882
19년 전 조회 4,382
19년 전 조회 5,012
19년 전 조회 3,176
19년 전 조회 2,912
19년 전 조회 3,517
19년 전 조회 2,056
19년 전 조회 2,409
19년 전 조회 2,702
19년 전 조회 2,784
19년 전 조회 2,366
19년 전 조회 1,631
19년 전 조회 3,401
19년 전 조회 1,993
19년 전 조회 2,404
19년 전 조회 2,466
19년 전 조회 2,891
19년 전 조회 5,219
19년 전 조회 2,502
19년 전 조회 3,346
19년 전 조회 4,287
19년 전 조회 2,523
19년 전 조회 2,480
19년 전 조회 4,055
19년 전 조회 2,768
19년 전 조회 3,009
19년 전 조회 2,225
19년 전 조회 2,236
19년 전 조회 2,017
19년 전 조회 3,299
19년 전 조회 2,136
19년 전 조회 2,810
19년 전 조회 1,759
19년 전 조회 5,332
19년 전 조회 3,574
19년 전 조회 4,330
19년 전 조회 3,075
19년 전 조회 2,543
19년 전 조회 3,940
19년 전 조회 2,663
19년 전 조회 3,004
19년 전 조회 2,969
19년 전 조회 4,192
19년 전 조회 3,143
19년 전 조회 3,035
19년 전 조회 3,696
19년 전 조회 2,999
19년 전 조회 2,224
19년 전 조회 2,242
19년 전 조회 2,183
19년 전 조회 2,783
19년 전 조회 2,497
19년 전 조회 3,362
19년 전 조회 3,209
19년 전 조회 1,839
19년 전 조회 2,754
19년 전 조회 7,851
19년 전 조회 2,520
19년 전 조회 3,129
19년 전 조회 2,878
19년 전 조회 3,031
19년 전 조회 2,239
19년 전 조회 2,461
19년 전 조회 4,086
19년 전 조회 2,242
19년 전 조회 4,244
19년 전 조회 2,400
19년 전 조회 2,099
19년 전 조회 2,343
19년 전 조회 1,890
19년 전 조회 2,424
19년 전 조회 2,215
19년 전 조회 3,085
19년 전 조회 1,870
19년 전 조회 3,559
19년 전 조회 2,717
19년 전 조회 3,462
19년 전 조회 3,464
19년 전 조회 3,167
19년 전 조회 5,450
19년 전 조회 2,183
19년 전 조회 2,235
19년 전 조회 2,324
19년 전 조회 3,408
19년 전 조회 3,719
19년 전 조회 3,764
19년 전 조회 2,368