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

Isn't \s recognized? #6

Closed
qcgm1978 opened this issue Oct 17, 2013 · 2 comments
Closed

Isn't \s recognized? #6

qcgm1978 opened this issue Oct 17, 2013 · 2 comments

Comments

@qcgm1978
Copy link

Hello:
My example:the test to be replaced

#version           2013-10-14

The following works:

replaceManifestVer: {
                src: ['<%= pkg.targetFolder %>/<%= pkg.help_release %>/help.manifest'],
                actions: [
                    {
                        name: 'update manifest ver',
                        search: '#version.+\-',
                        replace: '',
                        flags: 'g'
                    }
                ]
            }

The txt will leave '14', but the following doesn't work.

{
                        name: 'update manifest ver',
                        search: '#version\s+\-',
                        replace: '',
                        flags: 'g'
                    }

So \s can't be recognized. Why?

@qcgm1978
Copy link
Author

I have to use the stupid method...

replaceManifestVar: {
                src: ['<%= pkg.targetFolder %>/<%= pkg.help_release %>/help.manifest'],
                actions: [
                    {
                        name: 'update manifest ver',
                        search: '(#version.+\-[0-9]+)',
                        replace: '$1-<%= parseInt(Math.random()*100000) %>',
                        flags: 'g'
                    }
                ]
            }

@dlmiles
Copy link

dlmiles commented Aug 25, 2015

Did you try:

search: '#version\\s+',

As a single slash maybe eaten due to JavaScript strings also using similar sequences like '\n' and '\r', is it defined in the JS language specification what happens when the character after it is unknown.

Sorry for the w3schools link http://www.w3schools.com/js/js_strings.asp but it is stop google hit with relevance.

@bomsy bomsy closed this as completed Jan 30, 2016
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

3 participants