JavaScript 에서 정규 표현 식 으로 URL 일치
6155 단어 JavaScript 학습 노트
JavaScript URL
var strRegex = "^((https|http|ftp|rtsp|mms)?://)"
+ "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp user@
+ "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP URL- 199.194.52.184
+ "|" // IP DOMAIN( )
+ "([0-9a-z_!~*'()-]+\.)*" // - www.
+ "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." //
+ "[a-z]{2,6})" // first level domain- .com or .museum
+ "(:[0-9]{1,4})?" // - :80
+ "((/?)|" // a slash isn't required if there is no file name
+ "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";