JSFiddle - React, Tailwind, and code Playground
by unilecs
JavaScript
const re = /\*{2}(\s*)(.+?)(\s*)\*{2}/;
const str = 'Some random text ** The new Title ** some random text ';
let newstr = str.replace(re, '**$2**');
console.log(newstr);