请教大侠们一个问题啊,小弟不胜感激啊。
- HTML code
<table width="100%" align="center" id="sel" borderColorLight="#999999" borderColorDark="#ffffff" border=\"1\" cellSpacing=\"0\" cellPadding=\"0\">sdfsdf酸酸的复苏的</table><a>sdfsdf</a>sdfsdfs<table align="center">sdfsdf</table
上面的HTMl我想匹配id="sel"的table之间的内容,该怎么写啊?
谢谢啊。
------解决方案--------------------
- JScript code
var regex = /<table .+?id="sel"[\s\S]*?>(.*?)<\/table>/gi var html = '<table width="100%" align="center" id="sel" borderColorLight="#999999" borderColorDark="#ffffff" border=\"1\" cellSpacing=\"0\" cellPadding=\"0 \">sdfsdf酸酸的复苏的</table><a>sdfsdf</a>sdfsdfs<table align="center">sdfsdf</table>' var result = []; var m; while(m = regex.exec(html)) { result.push(m[1]) } alert(result.join(","))