Created
December 20, 2013 22:59
-
-
Save amix/8063003 to your computer and use it in GitHub Desktop.
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
// JavaScript that solves http://regex.alf.nu/ | |
// Run in Chrome or Firefox console | |
// Enjoy ;-) | |
// Some people, when confronted with a problem, think | |
// “I know, I'll use regular expressions.” | |
// Now they have two problems. | |
for(var lvl in levels) { | |
var fn = function(lvl) { | |
jump(lvl); | |
var bad = levels[lvl].bad; | |
var bad_w = []; | |
for(var i in bad) { | |
bad_w.push('^' + bad[i].replace(/\*/g, '\\*') + '$'); | |
} | |
var reg_exp = "^((?!"+ bad_w.join('|') +").)*$"; | |
document.getElementById("regex").value = reg_exp; | |
retest(); | |
save(); | |
} | |
setTimeout(fn.bind(window, lvl), lvl*1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment