Created
June 29, 2017 10:16
-
-
Save vsemozhetbyt/548cc2b50e9d994dd79027b701e37ed5 to your computer and use it in GitHub Desktop.
This file contains 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
'use strict'; | |
const { writeFileSync } = require('fs'); | |
const LAST_CODE_POINT = 0x10FFFF; | |
const RegExps = [/./u, /^(?!.)/, /\w/u, /\W/u, /\d/u, /\D/u, /\s/u, /\S/u, /\b/u, /\B/u]; | |
let codePoint = 0; | |
let str; | |
let data = ''; | |
while (codePoint <= LAST_CODE_POINT) { | |
str = String.fromCodePoint(codePoint); | |
data += `${codePoint} ${RegExps.filter(test).join(' ')}\n`; | |
codePoint++; | |
} | |
writeFileSync( | |
`code-points-vs-regexps.node.${process.versions.node}.V8.${process.versions.v8}.txt`, | |
data); | |
function test(re) { return re.test(str); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment