| 29 | // Special case for strings, to make the distinction between regexes and string matching |
| 30 | template <> |
| 31 | void |
| 32 | Matchers<std::string>::set(const std::string &d, CondModifiers mods) |
| 33 | { |
| 34 | _data = d; |
| 35 | if (mods & COND_NOCASE) { |
| 36 | _nocase = true; |
| 37 | } |
| 38 | |
| 39 | if (_op == MATCH_REGULAR_EXPRESSION) { |
| 40 | if (!_reHelper.setRegexMatch(_data, _nocase)) { |
| 41 | std::stringstream ss; |
| 42 | |
| 43 | ss << _data; |
| 44 | TSError("[%s] Invalid regex: failed to precompile: %s", PLUGIN_NAME, ss.str().c_str()); |
| 45 | Dbg(pi_dbg_ctl, "Invalid regex: failed to precompile: %s", ss.str().c_str()); |
| 46 | throw std::runtime_error("Malformed regex"); |
| 47 | } else { |
| 48 | Dbg(pi_dbg_ctl, "Regex precompiled successfully"); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | // Special case for strings, to allow for insensitive case comparisons for std::string matchers. |
| 54 | template <> |
no test coverage detected