<script> var p = /url\s*\((\s*\S+\s*)\)\s*;?/gi var s = "url(a.jpg);color:red;\nurl(b.gif)"; var arr = null; while((arr=p.exec(s)) != null){ for(var i =1;i<arr.length; i++){ alert(i+";"+arr[i]); } } --- 目前自己写的....但如果一行中有多个url就匹配不到了. 如s = "url(a.jpg);color:red;url(b.gif)"; 得到a.jpg);color:red;url(b.gif