Skip to content

Instantly share code, notes, and snippets.

@yiminghe
Created July 20, 2021 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yiminghe/b99c6d417e088ba34afdbc6973c59577 to your computer and use it in GitHub Desktop.
Save yiminghe/b99c6d417e088ba34afdbc6973c59577 to your computer and use it in GitHub Desktop.
re2 vs RegExp
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