node-unfluff icon indicating copy to clipboard operation
node-unfluff copied to clipboard

Bad regex causing very slow execution

Open kduffie opened this issue 5 years ago • 0 comments

If you attempt to run unfluff on the body of the following webpage, https://craftsbyamanda.com/vibrant-button-tree-on-canvas-a-giveaway/ you'll see that it takes more than 10secs on a fast Mac.

The problem has been isolated to line 22 of lib/extractor.js which takes around 10s to execute when operating on the contents of that particular webpage:

copyright = text.replace(/.*?©(\s*copyright)?([^,;:.|\r\n]+).*/gi, '$2').trim();

kduffie avatar Oct 14 '20 22:10 kduffie