JSFiddle - React, Tailwind, and code Playground

by brigand

JavaScript

const regex = /({1}(d*|s*|,)*){1}/g;

const sample =
    "K2, pm, k6 (6, 6, 6, 6, 6, 6, 8, 12, 10, 10, 16, 14), pm, k28 (30, 34, 34, 36, 34, 36, 34, 36, 34, 38, 38, 38), pm, k6 (6, 6, 6, 6, 6, 6, 8, 12, 10, 10, 16, 14), place a unique marker here (you will need to know this spot is different later on), k2. Do not join yet.";

const newString = sample.replace(regex, "test");
console.log(newString)