#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "require\('(.+?)'\)"
Local $sString = "'use strict';" & @CRLF & _
"" & @CRLF & _
"var path = require('path');" & @CRLF & _
"var _ = require('lodash');" & @CRLF & _
"var gulp = require('gulp');" & @CRLF & _
"require('gulp-help')(gulp);" & @CRLF & _
"var corejs = require('gulp-corejs');" & @CRLF & _
"" & @CRLF & _
"//region Build" & @CRLF & _
"" & @CRLF & _
"gulp.task('_bower_clean', function () {" & @CRLF & _
" var bower = require('bower');" & @CRLF & _
" return bower.commands.cache.clean(['corejs', 'pnotify', 'ui-bootstrap', 'emply-font', 'modernizr']);" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('bower', ['_bower_clean'], function () {" & @CRLF & _
" var bower = require('gulp-bower');" & @CRLF & _
" return bower({ cmd: 'update' })" & @CRLF & _
" .pipe(gulp.dest('bower_components'));" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('compile', function (cb) {" & @CRLF & _
" var buildConfig = {" & @CRLF & _
" appDir: 'src'," & @CRLF & _
" baseUrl: '.'," & @CRLF & _
" paths: {" & @CRLF & _
" text: '../bower_components/requirejs-text/text'," & @CRLF & _
" html: '../bower_components/requirejs-html/html'," & @CRLF & _
"" & @CRLF & _
" jquery: 'empty:'," & @CRLF & _
" angular: 'empty:'," & @CRLF & _
" 'angular-cache': 'empty:'," & @CRLF & _
" ngSanitize: 'empty:'," & @CRLF & _
" pnotify: 'empty:'," & @CRLF & _
" 'pnotify.modal': 'empty:'," & @CRLF & _
" 'pnotify.confirm': 'empty:'," & @CRLF & _
" 'pnotify.callbacks': 'empty:'," & @CRLF & _
" 'pnotify.nonblock': 'empty:'," & @CRLF & _
" 'ui.bootstrap': 'empty:'," & @CRLF & _
" infiniteScroll: 'empty:'," & @CRLF & _
" 'jquery.tabbable': 'empty:'," & @CRLF & _
" cfpHotkeys: 'empty:'," & @CRLF & _
" textile: 'empty:'," & @CRLF & _
" Modernizr: 'empty:'," & @CRLF & _
" 'tmh.dynamicLocale': 'empty:'" & @CRLF & _
" }," & @CRLF & _
" config: {" & @CRLF & _
" html: {" & @CRLF & _
" comments: 'strip'," & @CRLF & _
" whitespaceBetweenTags: 'collapse'," & @CRLF & _
" whitespaceBetweenTagsAndText: 'collapse'," & @CRLF & _
" whitespaceWithinTags: 'collapse'" & @CRLF & _
" }" & @CRLF & _
" }," & @CRLF & _
" dir: 'compiled'," & @CRLF & _
" removeCombined: true," & @CRLF & _
" optimize: 'none'," & @CRLF & _
" skipDirOptimize: true," & @CRLF & _
" fileExclusionRegExp: /\.spec\.js/," & @CRLF & _
" modules: [" & @CRLF & _
" { name: 'cmHelpers/module', exclude: ['text', 'html'] }," & @CRLF & _
" { name: 'cmMessages/module', exclude: ['text', 'html'] }," & @CRLF & _
" { name: 'cmYaMetrika/module' }," & @CRLF & _
" { name: 'cmFormPrimitives/module', exclude: ['text', 'html', 'cmHelpers/module'] }," & @CRLF & _
" { name: 'cmGoogleAnalytics/module', exclude: ['text', 'html', 'cmMessages/module'] }," & @CRLF & _
" {" & @CRLF & _
" name: 'cmWikiHelp/module'," & @CRLF & _
" exclude: ['html', 'cmHelpers/module', 'cmMessages/module', 'cmTranslate/module']" & @CRLF & _
" }," & @CRLF & _
" { name: 'cmMultiselect/module', exclude: ['text', 'html', 'cmFormPrimitives/module', 'cmHelpers/module'] }," & @CRLF & _
" {" & @CRLF & _
" name: 'cmSelectControls/module'," & @CRLF & _
" exclude: [" & @CRLF & _
" 'text'," & @CRLF & _
" 'html'," & @CRLF & _
" 'cmHelpers/module'," & @CRLF & _
" 'cmFormPrimitives/module'," & @CRLF & _
" 'cmWikiHelp/module'," & @CRLF & _
" 'cmMessages/module'," & @CRLF & _
" 'cmTranslate/module'" & @CRLF & _
" ]" & @CRLF & _
" }," & @CRLF & _
" { name: 'cmTranslate/module', exclude: ['text', 'html', 'cmHelpers/module'] }" & @CRLF & _
" ]" & @CRLF & _
" };" & @CRLF & _
" corejs.build.compile(buildConfig, cb);" & @CRLF & _
" gulp.src('bower.json')" & @CRLF & _
" .pipe(gulp.dest('./compiled'));" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('clean', function (cb) {" & @CRLF & _
" require('del')(['compiled/**/*.html', 'dist'], function () {" & @CRLF & _
" require('remove-empty-directories')('compiled');" & @CRLF & _
" cb();" & @CRLF & _
" });" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('zip', function () {" & @CRLF & _
" var zip = require('gulp-zip');" & @CRLF & _
" var bowerCfg = require(path.resolve('./bower.json'));" & @CRLF & _
" var files = [" & @CRLF & _
" 'compiled/**/*'," & @CRLF & _
" '!./**/*.txt'" & @CRLF & _
" ];" & @CRLF & _
"" & @CRLF & _
" gulp.src(files)" & @CRLF & _
" .pipe(zip('corejs-' + bowerCfg.version + '.zip'))" & @CRLF & _
" .pipe(gulp.dest('./dist'));" & @CRLF & _
"" & @CRLF & _
" gulp.src(files)" & @CRLF & _
" .pipe(zip('corejs-latest.zip'))" & @CRLF & _
" .pipe(gulp.dest('./dist'));" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"function build (cb, excluded) {" & @CRLF & _
" var tasks = [" & @CRLF & _
" 'bower'," & @CRLF & _
" 'compile'," & @CRLF & _
" 'clean'," & @CRLF & _
" 'zip'" & @CRLF & _
" ];" & @CRLF & _
" tasks = tasks.concat([cb]);" & @CRLF & _
"" & @CRLF & _
" _.remove(tasks, function (task) {" & @CRLF & _
" return _.includes(excluded, task);" & @CRLF & _
" });" & @CRLF & _
" require('run-sequence').apply(undefined, tasks);" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"gulp.task('build', 'Build production version (./dist folder)', function (cb) {" & @CRLF & _
" build(cb);" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('fastBuild', 'Build production version (./dist folder)', function (cb) {" & @CRLF & _
" build(cb, ['bower', 'compress']);" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"//endregion" & @CRLF & _
"" & @CRLF & _
"//region Developer tools" & @CRLF & _
"" & @CRLF & _
"gulp.task('bump', 'Increment version', function () {" & @CRLF & _
" return corejs.bump(['package.json', 'bower.json'])" & @CRLF & _
" .pipe(gulp.dest('./'));" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('styles', 'Compile CSS', function () {" & @CRLF & _
" return corejs.styles(['demo/styles/index.less'])" & @CRLF & _
" .pipe(gulp.dest('demo/styles'));" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('browsersync', function () {" & @CRLF & _
" require('browser-sync').create().init({" & @CRLF & _
" files: [" & @CRLF & _
" '{src,demo}/**/*'," & @CRLF & _
" '*.{json,js}'" & @CRLF & _
" ]," & @CRLF & _
" watchOptions: {" & @CRLF & _
" ignoreInitial: true," & @CRLF & _
" ignored: '{src,demo}/**/*.less'" & @CRLF & _
" }," & @CRLF & _
" open: false," & @CRLF & _
" proxy: 'localhost:2000'," & @CRLF & _
" port: 2015," & @CRLF & _
" logPrefix: 'BrowserSync'," & @CRLF & _
" logConnections: true" & @CRLF & _
" });" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('assemble', ['styles', 'i18n', 'packSvg']);" & @CRLF & _
"" & @CRLF & _
"gulp.task('watch', ['assemble'], function () {" & @CRLF & _
" // styles" & @CRLF & _
" corejs.watch(['src/**/*.less', 'demo/**/*.less'], ['styles']);" & @CRLF & _
"" & @CRLF & _
" // translates" & @CRLF & _
" corejs.watch(['src/**/*.json', 'demo/**/*.json'], ['i18n']);" & @CRLF & _
"" & @CRLF & _
" // svg packs" & @CRLF & _
" corejs.watch(['src/**/*.svg'], ['packSvg']);" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('live', ['browsersync', 'watch']);" & @CRLF & _
"" & @CRLF & _
"gulp.task('i18n', function () {" & @CRLF & _
" var extend = require('gulp-extend');" & @CRLF & _
" var locales = ['ru', 'en'];" & @CRLF & _
"" & @CRLF & _
" _.forEach(locales, function (locale) {" & @CRLF & _
" var jsonName = locale + '.json';" & @CRLF & _
" gulp.src(['src/**/' + jsonName, 'demo/**/' + jsonName])" & @CRLF & _
" .pipe(extend(jsonName))" & @CRLF & _
" .pipe(gulp.dest('i18n'));" & @CRLF & _
" });" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('packSvg', function () {" & @CRLF & _
" return corejs.packSvg(['src/**/*.svg'], 'pack.svg')" & @CRLF & _
" .pipe(gulp.dest('demo/images/'));" & @CRLF & _
"});" & @CRLF & _
"//endregion" & @CRLF & _
"" & @CRLF & _
"//region Karma tests" & @CRLF & _
"" & @CRLF & _
"gulp.task('test', 'Run tests once and exit', function (done) {" & @CRLF & _
" corejs.karma.test(done, 'karma.conf.js');" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('tdd', 'Run tests and start watching', function (done) {" & @CRLF & _
" corejs.karma.tdd(done, 'karma.conf.js');" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('test:jenkins', 'Run tests once and build reports', function (done) {" & @CRLF & _
" corejs.karma.jenkins(done, 'karma.conf.js');" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"//endregion" & @CRLF & _
"" & @CRLF & _
"//region Code style and lint" & @CRLF & _
"" & @CRLF & _
"var JS_FILES = ['src/**/*.js'];" & @CRLF & _
"" & @CRLF & _
"gulp.task('lint', 'Check JS syntax and show errors', function () {" & @CRLF & _
" return corejs.lint.check(JS_FILES, 'jshint-stylish');" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('lint:storm', 'Check JS syntax and show errors', function () {" & @CRLF & _
" return corejs.lint.check(JS_FILES, 'storm');" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('lint:jenkins', 'Check JS syntax and generate reports for jenkins', function () {" & @CRLF & _
" return corejs.lint.jenkins(JS_FILES, 'reports/corejs-lint.xml');" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('jscs', 'Check JS code style', function () {" & @CRLF & _
" return corejs.jscs.check(JS_FILES);" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('jscs:storm', 'Check JS code style', function () {" & @CRLF & _
" return corejs.jscs.check(JS_FILES, 'storm');" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('jscs:jenkins', 'Check JS code style and generate report for jenkins', function () {" & @CRLF & _
" return corejs.jscs.jenkins(JS_FILES, 'reports/corejs-codestyle.xml');" & @CRLF & _
"});" & @CRLF & _
"" & @CRLF & _
"gulp.task('storm', 'Run JS check style and syntax and show short report', ['lint:storm', 'jscs:storm']);" & @CRLF & _
"" & @CRLF & _
"//endregion" & @CRLF & _
"" & @CRLF & _
"gulp.task('jenkins', 'Run all jenkins-specific tasks', ['lint:jenkins', 'test:jenkins', 'jscs:jenkins']);" & @CRLF & _
""
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm