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.hh9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libutil/regex.hh b/src/libutil/regex.hh
index aa012b721cb7..53e31f4edc4a 100644
--- a/src/libutil/regex.hh
+++ b/src/libutil/regex.hh
@@ -5,16 +5,23 @@
 #include <sys/types.h>
 #include <regex.h>
 
+#include <map>
+
 namespace nix {
 
+MakeError(RegexError, Error)
+
 class Regex
 {
 public:
-    Regex(const string & pattern);
+    Regex(const string & pattern, bool subs = false);
     ~Regex();
     bool matches(const string & s);
+    typedef std::map<unsigned int, string> Subs;
+    bool matches(const string & s, Subs & subs);
 
 private:
+    unsigned nrParens;
     regex_t preg;
     string showError(int err);
 };