You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this is the expected behavior. This regex looks to be invalid. I think the regex you're looking for is grep(/.*\.js/). Note, grep()'s first argument should always be a regex, not a glob pattern to match files.
You can try the following example, it works. The first param is not regex, it is string. If you want to the first param is always string. you need to add some guard code.
The first parameter should be a regex. You can specify it either as a JS string or as a JS regex, but either way it should conform to regex syntax. This was to maintain consistent behavior. The only difference should be a matter of number of backslashes you need to escape. Hope this clarifies the confusion!
Your example is definitely correct. It should be identical in behavior to shelljs.echo("mytest").grep(/my/);, and that's the output I would expect. Hope this helps!
Node version: 6.1.0
ShellJS version (the most recent version/Github branch you see the bug on): 0.7.0
Operating system: Mac OS
Description of the bug:
Example ShellJS command to reproduce the error:
The text was updated successfully, but these errors were encountered: