JSFiddle - React, Tailwind, and code Playground

HTML

<div> The part number is [8F8S0JJ9]</div>
<div> The part number is</div>
<div> The second part number is [V9S7D73]</div>

JavaScript

var reg = /\[.*\]/;
$("div").filter(function(){
    return $(this).text().match(reg);  
}).html(function(i,h) { 
    var nr = h.match(reg);
    $(this).after(nr[0]);
    return h.replace(reg,'');
});