GitShow/sindresorhus/super-regex
sindresorhus

super-regex

Make a regular expression time out if it takes too long to execute

by sindresorhus
Star on GitHubForknpm

JavaScript

219 stars8 forks2 contributorsQuiet · 8mo agoSince 2022v1.1.0MIT

Meet the team

See all 2 on GitHub →
sindresorhus
sindresorhus12 contributions
Richienb
Richienb3 contributions

Languages

View on GitHub →
JavaScript99.3%
TypeScript0.7%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
sindresorhus
Add `throw` option?ClosedIssue

Some user may want to differentiate when a regex timed out and when it just didn't match. We could add a option (better name suggestion welcome!) that makes it throw a error instead returning an empty value.

sindresorhus · 8mo ago
sindresorhus
Async methodsClosedIssue

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.

sindresorhus · 8mo ago
silverwind
Idea for browser supportClosedIssue

It might be possible to create and spawn a temporary web worker from a datauri, execute the regex within and then terminate it on timeout. (Not really interested in implementing this, but it may be a nice exercise for someone 😉)

silverwind · 8mo ago
Structured data for AI agents

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.

·@ofershap

Replace github.com with gitshow.dev