* Parse matching regexp list and update the provided map with compiled expressions * * \param [in] node regex list node - should be of type sequence * \param [in] name group name, used as the map key * \param [out] map Reference to the map that will be updated with the compiled expressions */
| 753 | * \param [out] map Reference to the map that will be updated with the compiled expressions |
| 754 | */ |
| 755 | void Config::parseRegexpList(const YAML::Node &node, std::string name, |
| 756 | std::map<std::string, std::list<match_type_regex>> &map) { |
| 757 | |
| 758 | match_type_regex value; |
| 759 | |
| 760 | for (std::size_t i = 0; i < node.size(); i++) { |
| 761 | if (node[i].Type() == YAML::NodeType::Scalar) { |
| 762 | |
| 763 | try { |
| 764 | value.regexp = sregex::compile(node[i].as<std::string>(), |
| 765 | regex_constants::icase | regex_constants::not_dot_newline |
| 766 | | regex_constants::optimize | regex_constants::nosubs); |
| 767 | map[name].push_back(value); |
| 768 | |
| 769 | } catch (boost::exception_detail::clone_impl<boost::xpressive::regex_error> err) { |
| 770 | throw "Invalid regular expression pattern"; |
| 771 | } |
| 772 | |
| 773 | if (debug_general) |
| 774 | std::cout << " Config: compiled regexp hostname: " << node[i].as<std::string>() << std::endl; |
| 775 | } |
| 776 | } |
| 777 | } |
| 778 | |
| 779 | /** |
| 780 | * Parse matching prefix_range list and update the provided map with compiled expressions |