Using JS to extract specified characters from text

txt= "< div class=" question branchGroup0 questionPos1 "id=" questionId587271 "data-id=" 587271 "data-pos=" 1 "style=" outline: 1px solid blue; "> < style > .survey-video,. Video-player-iframe {min-height: 200px; border: none; max-width: 640px; max-height: 350px; margin: 0; padding: 0;}. Survey-media {margin: 10px auto;} < / style > < div class=" survey-media maxwidth500 ">"

"

I want to extract 587271 of the txt through JS, and write it into one line with multiple lines. Thank you

.
Mar.12,2021

regularities are singled out directly:

function getNumber(txt){
    let tArr = txt.match(/(Id\d+|id="\d+)/g);
    let result = [];
    tArr.forEach(function(item){
        let arr = item.match(/\d+/);
        result.push(arr[0]);
    });
    return result;
}
Menu