wrest.js 파일에서 궁금한 것이 있어서여.. > 그누3질답

그누3질답

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

그누보드 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. 앞에 질문했었는데.. 도움 주신 분들께 감사드립니다.
  • 복사

댓글 전체

다음링크를 참고하십시오
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)
© SIRSOFT
현재 페이지 제일 처음으로