-
-
Save yiminghe/b99c6d417e088ba34afdbc6973c59577 to your computer and use it in GitHub Desktop.
re2 vs RegExp
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
var RE2 = require("re2"); | |
var re=new RE2('(a+a+)+y'); | |
const str=''+('a'.repeat(20))+''; | |
let start=Date.now(); | |
console.log(!!str.match(re)); | |
console.log(Date.now()-start); | |
start=Date.now(); | |
console.log(!!str.match(/(a+a+)+y/)); | |
console.log(Date.now()-start); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment