diff options
Diffstat (limited to 'src/libstore/outputs-spec.cc')
-rw-r--r-- | src/libstore/outputs-spec.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libstore/outputs-spec.cc b/src/libstore/outputs-spec.cc index 096443cb2..e26c38138 100644 --- a/src/libstore/outputs-spec.cc +++ b/src/libstore/outputs-spec.cc @@ -1,8 +1,10 @@ +#include <regex> +#include <nlohmann/json.hpp> + #include "util.hh" +#include "regex-combinators.hh" #include "outputs-spec.hh" -#include "nlohmann/json.hpp" - -#include <regex> +#include "path-regex.hh" namespace nix { @@ -18,11 +20,14 @@ bool OutputsSpec::contains(const std::string & outputName) const }, raw()); } +static std::string outputSpecRegexStr = + regex::either( + regex::group(R"(\*)"), + regex::group(regex::list(nameRegexStr))); std::optional<OutputsSpec> OutputsSpec::parseOpt(std::string_view s) { - // See checkName() for valid output name characters. - static std::regex regex(R"((\*)|([a-zA-Z\+\-\._\?=]+(,[a-zA-Z\+\-\._\?=]+)*))"); + static std::regex regex(std::string { outputSpecRegexStr }); std::smatch match; std::string s2 { s }; // until some improves std::regex |