Last active
December 15, 2022 17:11
-
-
Save watson/7682ee718b9cf4aa2a5a605a3fb4a552 to your computer and use it in GitHub Desktop.
Node.js ReDoS example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for more info about ReDoS, see: | |
// https://en.wikipedia.org/wiki/ReDoS | |
var r = /([a-z]+)+$/ | |
var s = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa!' | |
console.log('Running regular expression... please wait') | |
console.time('benchmark') | |
r.test(s) | |
console.timeEnd('benchmark') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment