JSFiddle - React, Tailwind, and code Playground

by Kirubel Girma

HTML

<span id="id2">...</span>

JavaScript

const extFootnote = /\[(\d*)]:\s/g
const str = "[1]: Awesome times [2]: Awesome  [3]: Awesome [4]: Awesome";

const data = [...str.matchAll(extFootnote)]

document.getElementById("id2").innerHTML = "<b>The highest index is:</b> " + data[data.length - 1][1];
data.forEach(el => console.log(parseInt(el[1])));