Last active
August 29, 2015 14:16
-
-
Save MartinSvarrer/ca7bcbc39577a842a3ce to your computer and use it in GitHub Desktop.
Requirejs define function regex
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
// Regex breakdown: | |
// Group: define([ | |
// Group: dependencies | |
// Group: ], function ( | |
// Group: arguments | |
// Group: ) { | |
var defineFuncBeginning = /(define\s*?\(\s*?\[)([\S|\s]*?)(\]\s*,\s*function\s*\()([\s|\S]*?)(\)\s*?{)/gmi, | |
defineFuncBeginningResult = defineFuncBeginning.exec(file); | |
console.log(defineFuncBeginningResult[2]); // output: string with all dependencies |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment