正则匹配有Id的table - Web 开发 / 其他
请教大侠们一个问题啊,小弟不胜感激啊。
<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 regex = /<table .+?id="sel"[\s\S]*?>(.*?)<\/table>/givar 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(","))