이

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 조회 655
05-02-18 조회 567
05-02-18 조회 578
05-02-18 조회 446
05-02-18 조회 601
05-02-18 조회 738
05-02-18 조회 708
05-02-18 조회 664
05-02-18 조회 633
05-02-18 조회 885
05-02-18 조회 715
05-02-17 조회 971
05-02-17 조회 598
05-02-17 조회 594
05-02-17 조회 495
05-02-17 조회 673
05-02-17 조회 754
05-02-17 조회 687
05-02-17 조회 691
05-02-16 조회 553