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:
parent
3800f441e4
commit
104e55bb7f
5 changed files with 165 additions and 23 deletions
22
src/libutil/regex.hh
Normal file
22
src/libutil/regex.hh
Normal 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);
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue