Programming/Script

[Text] 홈페이지 형식 체크

deverexpert 2010. 1. 19. 10:12
/**
 * 올바른 홈페이지형식인지 체크합니다.
 */
function isValidHomepage(str) 
{
        var re=new regexp("^((ht|f)tp:\/\/)((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((\/|\\?)[a-z0-9~#%&'_\+=:\?\.-]*)*)$","gi");
        var matcharray=str.match(re);
        if (matcharray) return true;
        else return false;
}