JSFiddle - React, Tailwind, and code Playground

JavaScript

var mytext = '(1x) test0, (2x) test1, (3x) test2';

var formattedString = mytext.replace(/,/g, '\n');

console.log("FORMATTED STRING", formattedString)

const output = formattedString
    .split('', 4)
    .reduce((o, c) => (o.length === 4 ? `${o}${c}` : `${o}${c}`), '')

console.log("SPLIT", output)