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

Trying to hide all files except the ones in a specific directory #527

Closed
zwhitchcox opened this issue Jan 16, 2015 · 4 comments · May be fixed by #529
Closed

Trying to hide all files except the ones in a specific directory #527

zwhitchcox opened this issue Jan 16, 2015 · 4 comments · May be fixed by #529

Comments

@zwhitchcox
Copy link

I try to hide all files except the ones in the directory "meanio" like this:

node-debug --hidden ^(?!meanio$).* server.js

But I get this error:

-bash: !meanio: event not found

Side note, no regular expressions work, not just this one. It's just usually, it blatantly ignores my regex, and doesn't even give me an error.

I'm on yosemite with node version 0.10.35

@zwhitchcox
Copy link
Author

Ok, I've debugged the two reasons why my code wasn't working.

Forgive my newbiness, and I hope this helps someone else!

First of all, the options aren't included unless you place them before the main script. So, that's why my regex's weren't registering. that's probably a common thing here with unix commands, but as I said, I'm a noob, but I'm always learning!

Second of all, you have to escape your regular expression on the command line.

So, if you want to only include certain files or directories, you need do do a negative lookahead and escape the regular expression.

So, say you only wanted files with the word jacket or cake in the file. You could do that like this:

--hidden=^\(?\!\(.*jacket.*\)\|\(.*cake.*\)\)

If you just wanted files with the word jacket in them, you could do this:

--hidden=^\(?\!.*cake.*\)

Hope this helps someone else too!

@bajtos
Copy link
Member

bajtos commented Jan 23, 2015

A simpler way how to escape the regular expression argument is to use single quotes:

--hidden='^(?!.*cake.*)'

@3y3
Copy link
Member

3y3 commented Feb 17, 2015

@zwhitchcox , can this issue to be closed?

@3y3
Copy link
Member

3y3 commented May 14, 2015

No activity by long time. Feel free to reopen it, if issue doesn't solved.

@3y3 3y3 closed this as completed May 14, 2015
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

Successfully merging a pull request may close this issue.

3 participants