I'm trying to get rid of empty paragraphs using replace
with a regex, but not having luck.
return text.replace('/(<p><\/p>)+/g', '');
I've tested the regex /(<p><\/p>)+/g
in regex101 and it seems to be ok. What am I doing wrong?
Reproduction online
You should remove the quotes:
return text.replace(/(<p><\/p>)+/g, '');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With