Skip to content

Instantly share code, notes, and snippets.

@watson
Last active Aug 5, 2022
Embed
What would you like to do?
Node.js ReDoS example
// 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