大家好,我有以下代码:
<!--
<li class="dropdown">
<a href="#/score-board">Score Board</a>
<a href="#/score-lol">Score lol</a>
<a href="#/score-abcd">Score lolk</a>
</li>
-->
我需要有一个正则表达式
我试过了:
const regex = /(#.score([\s\S]*?).b([\s\S]*.?))/g;
const str = `<!--
<li class="dropdown">
<a href="#/score-board">Score Board</a>
<a href="#/score-abc">Score Board</a>
<a href="#/score-lol">Score Board</a>
</li>
-->`;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
&#13;
我希望得到以下结果 的#/分板
有人可以帮助我吗?
注意!重要的是它取得&#34; 和&#34;
之间的所有内容提前谢谢