stripHtml with \n regex html

Benchmark created on


Preparation HTML

<script src="https://cdn.jsdelivr.net/npm/string-strip-html/dist/string-strip-html.umd.js"></script>

Setup

const { stripHtml } = stringStripHtml;
const html = "<p>hoi</p>test<br/>";

Test runner

Ready to run.

Testing in
TestOps/sec
Without \n regex
return stripHtml(html).result;
ready
With \n regex
const htmlToStrip = html
      .replace(/<br\s*\/?>/gi, "\r\n")
      .replace(/<\/p\s*>/gi, "\r\n</p>");
return stripHtml(htmlToStrip).result;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.