Last active
August 29, 2015 14:06
-
-
Save FGRibreau/af15e1fd9406af644e3a to your computer and use it in GitHub Desktop.
Regex to hang on V8 engine (Chrome/NodeJS)
This file contains hidden or 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
// The following script will hang on V8 regex engine. (It works fine on Safari Mac). | |
// Regex was taken from https://gist.github.com/gruber/249502 | |
"http://www.ghislainproulx.net/Blog/2014/09/contributing-to-a-github-open-source-project-(from-a-visual-studio-developer-perspective)".replace(/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi, function(url){ | |
// this will never be executed on Chrome/Node | |
console.log(url); | |
}); | |
// Checkout your CPU consumption ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment