re=/<tr>[\s\S]*?<\/tr>/gm s="<body>\n<tr><span>foo\n</span></tr>\nfoo<div>foo</div>\n<tr>bar</tr><tr>baz</tr></body>" alert(s.match(re).join(""))