Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regexp not matching. #28

Open
karimbeyrouti opened this issue Nov 19, 2014 · 5 comments
Open

Regexp not matching. #28

karimbeyrouti opened this issue Nov 19, 2014 · 5 comments

Comments

@karimbeyrouti
Copy link

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.

@yoniholmes
Copy link
Owner

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

@karimbeyrouti
Copy link
Author

Thank you Jonathan, currently looking into it - and not finding anything obvious. Will let you know if I get to the bottom of this.

@karimbeyrouti
Copy link
Author

Interestingly enough - this looks like a windows issue. The same script works on OSX - with same version of Node & Grunt ...

@gabrielmaldi
Copy link

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.

@Rainbowlemon
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants