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
/[^-]+(width[^]+)/g测试代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head>
<body>
<script language="javascript">
<!--
str ="width : 697pxwidth : 693pxwidth:694pxwidth : 695pxwidth : 696pxborder:1px solid #cccborder-width:3px"
re = /[^-]+(width[^]+)/g
alert(str.match(re))
//-->
</script>
</body>
</html>
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'))