JSFiddle - React, Tailwind, and code Playground
JavaScript
const data = "Some random text ** The new Title ** random text";
const reqexp = /\*\*\s*(.*\b)\s*\*\*/g;
console.log(data.replace(reqexp, '**$1**'));
const data = "Some random text ** The new Title ** random text";
const reqexp = /\*\*\s*(.*\b)\s*\*\*/g;
console.log(data.replace(reqexp, '**$1**'));