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.
^#.*$
or
^#[^\n]*
Try this.Because you have not specified $ it will consume all till EOF.