Make a regular expression time out if it takes too long to execute
by sindresorhusJavaScript
Last 12 weeks · 0 commits
4 of 6 standards met
I think it could be useful with async methods too, when you not only want to prevent abuse, but also don't want the regex matching to block other work, which can be important in a server context. We could do the matching on a worker thread and then send the result back to the main process. This should be possible on both Node.js and the browser. This is not something I plan to work on, but a good pull request would be welcomed if you need this. See https://github.com/sindresorhus/crypto-hash/blob/main/index.js for an example of how it could be done.
Repository: sindresorhus/super-regex. Description: Make a regular expression time out if it takes too long to execute Stars: 219, Forks: 8. Primary language: JavaScript. Languages: JavaScript (99.3%), TypeScript (0.7%). License: MIT. Latest release: v1.1.0 (8mo ago). Open PRs: 0, open issues: 0. Last activity: 8mo ago. Community health: 85%. Top contributors: sindresorhus, Richienb.