Created
September 4, 2015 00:53
-
-
Save lcaballero/24086d53c3e4e7eb5d01 to your computer and use it in GitHub Desktop.
Find \num
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
matches = [ | |
[ "abc", false ], | |
[ "a\\1d", true ] | |
] | |
re = /\\[0-9]/; | |
for (var i = 0; i < matches.length; i++) { | |
str = matches[i][0]; | |
expected = matches[i][1]; | |
val = re.test(str); | |
console.log("%s contains re %s (passes: %s)", str, val, val === expected); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! Very clean. I like the way you use arrays as tuples.