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

Thread panic due to "incorrect regex expression" #44

Closed
JeffCarpenter opened this issue Mar 6, 2019 · 2 comments
Closed

Thread panic due to "incorrect regex expression" #44

JeffCarpenter opened this issue Mar 6, 2019 · 2 comments

Comments

@JeffCarpenter
Copy link

JeffCarpenter commented Mar 6, 2019

It's pretty short, so I'll leave the trace here:

% RUST_BACKTRACE=1 fselect "select path from . where path regexp \(NOT '^./code'\) and name regexp '\.conf$'

thread 'main' panicked at 'Incorrect regex expression', src/searcher.rs:1246:45
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: __libc_start_main
  17: <unknown>
jhspetersson added a commit that referenced this issue Mar 6, 2019
@jhspetersson
Copy link
Owner

Thank you for the issue!

Unfortunately, expression negation (NOT before regexps or anything else) is not currently supported.
With the release version it is possible to rewrite the command to this one (note that globs work with = and !=):

fselect "path from . where path rx '^\./[^c][^o][^d][^e]' and name = *.conf"

...what is really terrible for somewhat lengthy prefixes.

So I updated the master with !=~ and notlike operators to negate the regexp operand.
Please try this one:

fselect "path from . where path !=~ '^\./code' and name = *.conf"

I suppose NOT negation to be implemented in some future.

@JeffCarpenter
Copy link
Author

Thanks for the solution. This is going to be a great tool for getting a handle on all the config files in my home directory!

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

2 participants