JSFiddle - React, Tailwind, and code Playground

by forgetcolor

HTML

<a class='atest' href='/atest'>
  <i class='itest1'></i>
  1 word
</a>

JavaScript

$('.atest').each(function() {
    var linkhtml = $(this).html();
    linkhtml = linkhtml.replace(/\n/g, "");
    var parsed = linkhtml.match(/(.*)(\d+(?:,\d+)*)\s+(.*)/);
    
    console.log("linkhtml: " + linkhtml);
    console.log("linkhtml parsed: " + parsed);
});

console.log("\n");

var testline = "<i class='itest1'></i>2 words";
var newparsed = testline.match(/(.*)(\d+(?:,\d+)*)\s+(.*)/);

console.log("testline: " + testline);
console.log("testline parsed: " + newparsed);