Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望这个正则表达式匹配所有十种<tr></tr>组合(以及介于两者之间的所有内容,给定一个 HTML 表。
<tr></tr>
var re = /<tr>.*<\/tr>/g;
var re = /<tr>.*<\/tr>/g
但是整个字符串是匹配的。为什么?
http://jsfiddle.net/zL6Qx/
您应该使用非贪婪匹配正则表达式:
var re = /<tr>.*?<\/tr>/g;