8 #include <boost/algorithm/string.hpp> 9 #include <boost/regex.hpp> 20 static const boost::regex expression(
"\\$(([A-Za-z0-9_]+)|\\(([A-Za-z0-9_]+)\\))" );
25 boost::match_results<std::string::const_iterator> what;
26 boost::match_flag_type flags = boost::match_default;
27 while ( boost::regex_search(
start,
end, what, expression, flags ) ) {
29 if ( var.empty() ) var =
std::string{what[3].first, what[3].second};
32 boost::algorithm::replace_first( result,
std::string{what[0].first, what[0].second}, env );
34 start = what[0].second;
36 flags |= boost::match_prev_avail;
37 flags |= boost::match_not_bob;
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
std::string replaceEnvironments(const std::string &input)