diff --git a/components/core/src/clp/regex_utils/constants.hpp b/components/core/src/clp/regex_utils/constants.hpp index 83ba3fabd..9833543fc 100644 --- a/components/core/src/clp/regex_utils/constants.hpp +++ b/components/core/src/clp/regex_utils/constants.hpp @@ -38,11 +38,12 @@ constexpr char cEscapeChar{'\\'}; constexpr char cCharsetNegate{'^'}; // Character bitmaps -// The set of characters that can be preceded with an escape backslash. When escaped, these -// characters are used as literals. -constexpr auto cRegexEscapeSeqMetaCharsLUT = create_char_bit_array("*+?|^$.{}[]()<>-_/=!\\"); -// The set of metacharacters that need to be escaped in the wildcard syntax. -constexpr auto cWildcardMetaCharsLUT = create_char_bit_array("?*\\"); +// The set of regex metacharacters that can be preceded with an escape backslash to be treated as a +// literal. +constexpr auto cRegexEscapeSeqMetaCharsLut = create_char_bit_array("*+?|^$.{}[]()<>-_/=!\\"); +// The set of wildcard metacharacters that must remain escaped in the translated string to be +// treated as a literal. +constexpr auto cWildcardMetaCharsLut = create_char_bit_array("?*\\"); } // namespace clp::regex_utils #endif // CLP_REGEX_UTILS_CONSTANTS_HPP diff --git a/components/core/src/clp/regex_utils/regex_translation_utils.cpp b/components/core/src/clp/regex_utils/regex_translation_utils.cpp index 9f153aae0..61f8481f2 100644 --- a/components/core/src/clp/regex_utils/regex_translation_utils.cpp +++ b/components/core/src/clp/regex_utils/regex_translation_utils.cpp @@ -179,10 +179,10 @@ auto escaped_state_transition( [[maybe_unused]] RegexToWildcardTranslatorConfig const& config ) -> error_code { auto const ch{*it}; - if (false == cRegexEscapeSeqMetaCharsLUT.at(ch)) { + if (false == cRegexEscapeSeqMetaCharsLut.at(ch)) { return ErrorCode::IllegalEscapeSequence; } - if (cWildcardMetaCharsLUT.at(ch)) { + if (cWildcardMetaCharsLut.at(ch)) { wildcard_str = wildcard_str + cEscapeChar + ch; } else { wildcard_str += ch;