не могли бы вы быть более точным, и приведите нам пример."после чистки"
const regex = /\(g\):\n([1-9]*)/gm;
const str = `Medidas aproximadas para gravação (CxD):
1,4 cm x 3,5 cm
Tamanho total aproximado (CxD):
46,5 cm x 38 cm
Height (g):
1711
O peso e as medidas podem variar porque o mesmo modelo é produzido por diversos fabricantes
Veja mais brindes
Mochilas e Necessaires, Mochila"`;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}