grunt-text-replace
grunt-text-replace copied to clipboard
Regexp not matching.
Hello there,
For some reason my regexp search and replace is no longer matching my selection - not sure which version this started happening with, however it used to work just fine. Nothing changed my side. ( I am using latest grunt / grunt-cli / replace ) .
Here is my replace grunt task:
replace: {
removeextend: {
src: ['bin/js/**/*.js'],
overwrite: true, // overwrite matched source files
replacements: [{
from: /var __extends[\W\S\D]*__\(\);\s};/g,
to: ""
}]
}
},...
and an example file: http://kurst.co.uk/transfer/JSONLoader.js
Here is the Regex in action: http://www.regexr.com/39u9o
Not sure why this stopped working - that query used to work. Any insight into why this stopped working would be welcome.
Thank you for your time.
Hi Karim, thanks for raising this. Nothing's changed about the plugin for a good while, so not sure what might be going wrong. FYI I'm pretty stacked at the moment, so can't look at this immediately, but will try when I can. If you get any further with investigations let me know.
Thanks again,
Jonathan
Thank you Jonathan, currently looking into it - and not finding anything obvious. Will let you know if I get to the bottom of this.
Interestingly enough - this looks like a windows issue. The same script works on OSX - with same version of Node & Grunt ...
I had the same issue and it turned out to be that my RegExp was trying to match newlines in a way that worked in OS X but didn't in Windows.
I'm just playing around with this now, and it seems the plugin isn't matching spaces properly. I'm trying to read a json file, manifest.json
, using a function call and a grunt.log
to see what's going on (it would be great if this plugin outputted what was changed!), and when I try and match \"version\"
it works fine, but when I try and match \"version\"
with a space it does nothing.