Initializes the m_apRegex member using the other members. Call this method before needing to access the regex object. Note: m_apRegex will remain null if the regular expression is invalid.
| 253 | // Note: m_apRegex will remain null if the regular expression is invalid. |
| 254 | // |
| 255 | void RegexPipelineElement::InitRegex() const |
| 256 | { |
| 257 | // Only init once. |
| 258 | if (!m_RegexTested) { |
| 259 | // Try creating regex. Keep null if the regex is invalid. |
| 260 | try { |
| 261 | if (!m_Regex.empty()) { |
| 262 | #pragma warning(suppress: 26812) // std::regex_constants::syntax_option_type could be enum class |
| 263 | std::regex_constants::syntax_option_type reOptions = std::regex_constants::ECMAScript; |
| 264 | if (m_IgnoreCase) { |
| 265 | reOptions |= std::regex_constants::icase; |
| 266 | } |
| 267 | m_upRegex = std::make_unique<std::wregex>(m_Regex, reOptions); |
| 268 | } |
| 269 | } catch (const std::regex_error&) { |
| 270 | assert(m_upRegex == nullptr); |
| 271 | } |
| 272 | m_RegexTested = true; |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | // |
| 277 | // Modifies the given path by replacing certain parts of the |