JSFiddle - React, Tailwind, and code Playground

JavaScript

var string = "[Name_is][234]"
var matches = string.match(/\[(\d+)]/);

if (matches.length) {
    var num = matches[1];
    
    alert(num);
}