Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
173 B
1
Indexable
Never
const x = '<p></p><p>Test</p><p></p>';
const regex = /<p><\/p>(?![\s\S]*<p>[^<>]*<\/p>)/;
const replacedX = x.replace(regex, '<p>Replacement</p>');

console.log(replacedX);