Skip to content

Instantly share code, notes, and snippets.

@DmitrySoshnikov
Created April 17, 2017 19:57
Show Gist options
  • Save DmitrySoshnikov/5cc481a1bde3a1e54e74201ce4395aac to your computer and use it in GitHub Desktop.
Save DmitrySoshnikov/5cc481a1bde3a1e54e74201ce4395aac to your computer and use it in GitHub Desktop.
regexp-tree-compat-transpiler
const regexpTree = require('regexp-tree');
// Using new syntax.
const originalRe = '/(?<all>.)\\k<all>/s';
// For legacy engines.
const compatTranspiledRe = regexpTree
.compatTranspile(originalRe)
.toRegExp();
console.log(compatTranspiledRe); // /([\0-\uFFFF])\1/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment