Код: Выделить всё
const test = `
Title and stuff
- Yo[/b][b]
images/path/4137974393811117.png
Preface.[/b]
[i]What if making excellent menu systems was as easy as a single command, and you also had access to the code?[/i]
`;
let result = test.replace(/([\s\S]*)/gi, '[b]$1[/b]');
console.log(result);
Подробнее здесь: https://stackoverflow.com/questions/794 ... -incorrect