JSFiddle - React, Tailwind, and code Playground
JavaScript
var s = "abc8 23 123";
s = s.replace(/\d+/g, function(m){
return "00000".substr(m.length - 1) + m;
});
alert(s);
var s = "abc8 23 123";
s = s.replace(/\d+/g, function(m){
return "00000".substr(m.length - 1) + m;
});
alert(s);