JSFiddle - React, Tailwind, and code Playground
JavaScript
var str = 'example12',
matches = str.match(/\d+$/),
number;
if (matches) {
number = matches[0];
}
// It is an Array. The 0 element will be the number.
console.log(number)
document.body.innerHTML = number;