0

Hello everyone I have got following code:

<!--
            <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>
            -->

that I need to have a regex for

I have tried:

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}`);
    });
}

I want instead to have following result
#/score-board

Could someone help me out?

Notice! the important is it fetch everything between " and "

Thank you in advance

ctwheels
  • 20,701
  • 7
  • 36
  • 71

0 Answers0