diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-10-03 18:47:16 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-10-03 21:29:40 +0200 |
commit | 104e55bb7f593b1ac3c54ffda48a9d72af7fbe6b (patch) | |
tree | 92eea5af2736190ec196a4bc68c16ea5f16dff2f /src/libutil/regex.hh | |
parent | 3800f441e49af78b95d403014459dbb9bb646e8a (diff) |
nix-env: Add regular expression support in selectors
So you can now do things like:
$ nix-env -qa '.*zip.*'
$ nix-env -qa '.*(firefox|chromium).*'
Diffstat (limited to 'src/libutil/regex.hh')
-rw-r--r-- | src/libutil/regex.hh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libutil/regex.hh b/src/libutil/regex.hh new file mode 100644 index 000000000..aa012b721 --- /dev/null +++ b/src/libutil/regex.hh @@ -0,0 +1,22 @@ +#pragma once + +#include "types.hh" + +#include <sys/types.h> +#include <regex.h> + +namespace nix { + +class Regex +{ +public: + Regex(const string & pattern); + ~Regex(); + bool matches(const string & s); + +private: + regex_t preg; + string showError(int err); +}; + +} |