1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 16:31:47 +02:00

nix-env: Add regular expression support in selectors

So you can now do things like:

  $ nix-env -qa '.*zip.*'
  $ nix-env -qa '.*(firefox|chromium).*'
This commit is contained in:
Eelco Dolstra 2014-10-03 18:47:16 +02:00
parent 3800f441e4
commit 104e55bb7f
5 changed files with 165 additions and 23 deletions

22
src/libutil/regex.hh Normal file
View file

@ -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);
};
}