이

wrest.js 파일에서 궁금한 것이 있어서여..

function wrestEmail(fld)
{
if (!wrestTrim(fld)) return;

//var pattern = /(\S+)@(\S+)\.(\S+)/; 전자메일주소에 한글 사용시
var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
if (!pattern.test(fld.value)) {
if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + " : 전자메일주소 형식이 아닙니다.\n";
wrestFld = fld;
}
}
}

pattern.test(fld.value) <---- 이 부분인데.. test() 이 함수는 어디서 발췌가 되나요?? 설마.. 내장함수는 아니겠죠??

유독 패턴 사용시 이렇게 코딩이 되어있는데.. 패턴과 매치되는 그런 함수가 되나요??

고수님의 도움 요청합니다.

ps. 앞에 질문했었는데.. 도움 주신 분들께 감사드립니다.

댓글 1개

다음링크를 참고하십시오
http://www.cis.upenn.edu/~matuszek/General/JavaScript/concise-javascript-1.html#regular-expressions

string.search(pattern)
string.replace(pattern, replacement)
string.match(pattern)
string1.split(string2_or_pattern)
pattern.exec(string)
pattern.test(string)
댓글을 작성하시려면 로그인이 필요합니다.

그누3질답

9,564건
+
제목 글쓴이 날짜 조회
05-02-18 조회 657
05-02-18 조회 568
05-02-18 조회 579
05-02-18 조회 449
05-02-18 조회 605
05-02-18 조회 740
05-02-18 조회 709
05-02-18 조회 668
05-02-18 조회 635
05-02-18 조회 889
05-02-18 조회 717
05-02-17 조회 972
05-02-17 조회 601
05-02-17 조회 596
05-02-17 조회 499
05-02-17 조회 675
05-02-17 조회 755
05-02-17 조회 689
05-02-17 조회 694
05-02-16 조회 556