0

Ii am trying to remove all lines of code that begin with #. I found a grunt plugin called lineremover but for some reason I cannot achieve it. Inside my Gruntfile.js, I have this configuration for lineremover:

 lineremover: {
     files: {
         'dest.txt': [ 'origin.txt' ]
     },
     options: {
         exclusionPattern: /^[#].*/
     }
 }

I am new to both grunt and regular expression so I don't know where is the problem. I am sure the file is correct. Also, if instead of a regular expression, I specify a string, the lines where that string is found are removed. So, the problem occurs only when I use that expression. The error I get is

destination not written because no lines were remaining

, which would mean that my regexp removes all the lines from the file.

4

1 に答える 1

0
^#.*$

また

^#[^\n]*

$ を指定していないため、EOF まですべてを消費します。

于 2014-10-20T10:14:46.543 に答える