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.
var search = new RegExp("<span class=\"highlight\">(?<text>.*)</span>", "g");
正则表达式有问题吗?Firebug 只是说“无效的量词”。就是这样,没有更多的信息。
问号量词在那里是错误的。您想在括号之间进行匹配和收集()。这样做(?是错误的,如果你想匹配(你应该转义括号。
()
(?
(
var search = new RegExp("<span class=\"highlight\">(<text>.*)</span>", "g");