Pattern pattern = Pattern.compile("(flv|f4v|mkv|rm|rmvb|mpg|mpeg|mpeg4|wmv|3gp|mp4|mov|avi|asx|asf|ts|qt){1}$",Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(type); boolean result= matcher.find();
主要是参数Pattern.CASE_INSENSITIVE,是忽略大小写
js代码:
var flag = true; var re= new RegExp("(\.|\/)(flv|f4v|mkv|rm|rmvb|mpg|mpeg|mpeg4|wmv|3gp|mp4|mov|avi|asx|asf|ts|qt)$","gi"); flag= re.test(fileName);主要参数 gi,表示全局都忽略大小写 原文链接:https://www.f2er.com/regex/360229.html