diff --git a/docs/README.md b/docs/README.md index 8af2f99..cb77ea7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -312,6 +312,47 @@ replace: { } ``` +#### Regular expression Multiple Ranges + +File `index.html`: + +``` + + + + + +... other stuff + + + + + +``` + +Gruntfile: + +```js +replace: { + dist: { + options: { + patterns: [ + { + match: /(.|\n|\r)*?/g, + replacement: '', + } + ] + }, + files: [ + {expand: true, flatten: true, src: ['src/index.html'], dest: 'dist'} + ] + } +} +``` + +This matches all the lines in between the `` tags we defined. It is useful if you have multiple blocks of javascript imports that you want to omit in from your `index.html` in your build (i.e. because you are concatenating them all in one file. +You must include the `?` to ensure lazy matching (i.e. match the first possible match) and `/g` to ensure that after a match is found, the rest of the string is searched for more [more info](http://javascript.info/tutorial/greedy-and-lazy). + #### Lookup for `foo` instead of `@@foo` Gruntfile: