Skip to content

Instantly share code, notes, and snippets.

@amotmot
Created June 1, 2015 21:54
Show Gist options
  • Save amotmot/a424096d8b06bff945b8 to your computer and use it in GitHub Desktop.
Save amotmot/a424096d8b06bff945b8 to your computer and use it in GitHub Desktop.
ReDos
function validateReDoS( string ) {
var expression = /(.|..){999}/;
return expression.test( string );
}
start = process.hrtime();
console.log(validateReDoS('[email protected]'));
console.log(process.hrtime(start));
start = process.hrtime();
console.log(validateReDoS("jjjjjjjjjjjjjjjjjjjjjjjjjjjj@ccccccccccccccccccccccccccccc.5555555555555555555555555555555555555555{"));
console.log(process.hrtime(start));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment