\brief Helper to parse optional regex string safely
| 509 | |
| 510 | //! \brief Helper to parse optional regex string safely |
| 511 | static command_result parseRegexParam(std::regex& target, |
| 512 | color_ostream& out, |
| 513 | std::vector<std::string>& parameters, |
| 514 | size_t pos) |
| 515 | { |
| 516 | if (parameters.size() <= pos) |
| 517 | return CR_OK; |
| 518 | try { |
| 519 | std::regex temp{parameters[pos], defaultRegex}; |
| 520 | target = std::move(temp); |
| 521 | } catch(std::regex_error & e) { |
| 522 | ERR(command,out) << "Failed to parse regular expression '" |
| 523 | << parameters[pos] << "'\n"; |
| 524 | ERR(command,out) << "Parser message: " << e.what() << std::endl; |
| 525 | return CR_WRONG_USAGE; |
| 526 | } |
| 527 | return CR_OK; |
| 528 | } |
| 529 | |
| 530 | /*! |
| 531 | * "Algorithm" to apply category filters based on optional regex parameters. |
no test coverage detected