2 ms·
It would be easy to create a regex that consumes a lot of CPU power. It's very difficult to vet a regex in an automated fashion.
by Twirrim 10y ago
It would be easy to create a regex that consumes a lot of CPU power. It's very difficult to vet a regex in an automated fashion.
- Someone1234 10y agoThen don't vet it. Just run it as is, and limit how many local resources it can consume (CPU cycles and RAM). Then add on a timeout for good measure, and you are good to go.
- ZoFreX 10y agoAlternatively, where possible, use a regular expression engine that does not have that issue: https://swtch.com/~rsc/regexp/regexp1.html https://swtch.com/~rsc/regexp/regexp1.html