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,002
19년 전 조회 2,137
19년 전 조회 1,696
19년 전 조회 2,379
19년 전 조회 2,027
19년 전 조회 1,652
19년 전 조회 1,826
19년 전 조회 2,085
19년 전 조회 1,856
19년 전 조회 1,629
19년 전 조회 1,696
19년 전 조회 3,183
19년 전 조회 2,045
19년 전 조회 1,901
19년 전 조회 4,401
19년 전 조회 5,030
19년 전 조회 3,199
19년 전 조회 2,931
19년 전 조회 3,538
19년 전 조회 2,082
19년 전 조회 2,441
19년 전 조회 2,727
19년 전 조회 2,805
19년 전 조회 2,410
19년 전 조회 1,666
19년 전 조회 3,424
19년 전 조회 2,022
19년 전 조회 2,431
19년 전 조회 2,484
19년 전 조회 2,929
19년 전 조회 5,256
19년 전 조회 2,519
19년 전 조회 3,364
19년 전 조회 4,309
19년 전 조회 2,543
19년 전 조회 2,498
19년 전 조회 4,089
19년 전 조회 2,782
19년 전 조회 3,027
19년 전 조회 2,248
19년 전 조회 2,266
19년 전 조회 2,050
19년 전 조회 3,335
19년 전 조회 2,160
19년 전 조회 2,835
19년 전 조회 1,795
19년 전 조회 5,351
19년 전 조회 3,602
19년 전 조회 4,350
19년 전 조회 3,089
19년 전 조회 2,580
19년 전 조회 3,961
19년 전 조회 2,678
19년 전 조회 3,023
19년 전 조회 2,995
19년 전 조회 4,215
19년 전 조회 3,178
19년 전 조회 3,053
19년 전 조회 3,734
19년 전 조회 3,040
19년 전 조회 2,264
19년 전 조회 2,272
19년 전 조회 2,219
19년 전 조회 2,825
19년 전 조회 2,520
19년 전 조회 3,383
19년 전 조회 3,231
19년 전 조회 1,861
19년 전 조회 2,781
19년 전 조회 7,885
19년 전 조회 2,555
19년 전 조회 3,153
19년 전 조회 2,912
19년 전 조회 3,063
19년 전 조회 2,260
19년 전 조회 2,489
19년 전 조회 4,105
19년 전 조회 2,280
19년 전 조회 4,268
19년 전 조회 2,436
19년 전 조회 2,121
19년 전 조회 2,366
19년 전 조회 1,920
19년 전 조회 2,453
19년 전 조회 2,241
19년 전 조회 3,111
19년 전 조회 1,899
19년 전 조회 3,574
19년 전 조회 2,753
19년 전 조회 3,476
19년 전 조회 3,483
19년 전 조회 3,183
19년 전 조회 5,480
19년 전 조회 2,218
19년 전 조회 2,266
19년 전 조회 2,360
19년 전 조회 3,433
19년 전 조회 3,739
19년 전 조회 3,778
19년 전 조회 2,388