Skip to content

Instantly share code, notes, and snippets.

@mreis1
Created December 1, 2018 10:27
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 mreis1/27c6a1a05b4c0c549ae4fd2c4169d60d to your computer and use it in GitHub Desktop.
Save mreis1/27c6a1a05b4c0c549ae4fd2c4169d60d to your computer and use it in GitHub Desktop.
Usefull js regex
Replace content between two comments
var content = `
//@CR_NAME
var BAR='';
var FOO='';
//@CR_END_NAME
`;
content.replace(/\/\/@CR_NAME(.|\n)*\/\/@CR_END_NAME/gi, 'NAME="'+ pkg.name + '";')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment