about summary refs log tree commit diff
path: root/src/libutil/regex.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/regex.hh')
-rw-r--r--src/libutil/regex.hh22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libutil/regex.hh b/src/libutil/regex.hh
new file mode 100644
index 000000000000..aa012b721cb7
--- /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);
+};
+
+}