VBScript codes=".x{background:url(images/nan_bg_o.jpg)}.xx{}.xxx{background: URL(images/nan_bg_oxx.jpg) }"
set rx=new RegExp
rx.IgnoreCase=true
rx.Global=true
rx.Pattern="url\s*\(([^\)]+)\)"
set mc=rx.Execute(s)
for each m in mc
response.Write "<pre>"&m.submatches(0)&"</pre>"
next
set rx=nothing
写两个正则好容易些,如:
var reg1=/\w*.css$/var reg2=/\w*.min.css$/
var t='aa.min.css'
if(reg1.test(t) && !reg2.test(t)){
alert(t)
}
var testContent = '.class1{ color:red }.class2 { color:blue }'function getCss(className){
var reStr = '\.' + className + '[ \s]*\{[^\}]+?\}'
var re = new RegExp(reStr, "gi")
return testContent.match(re)
}
alert(getCss('class1'))
alert(getCss('class2'))