Open pwuertz opened 4 years ago
CTRE doesn't seem to support lookbehind rules, like (?<=x) or (?<!x).
(?<=x)
(?<!x)
Compiler-explorer / GCC trunk reports a failed assertion in functions.hpp:
functions.hpp
/opt/compiler-explorer/libs/ctre/master/include/ctre/functions.hpp:74:23: error: static assertion failed: Regular Expression contains syntax error.
Example:
#include <ctre.hpp> constexpr bool a_not_preceded_by_b(const std::string_view s) { constexpr auto pattern1 = ctll::fixed_string{ "[^b](?=a)" }; // Works constexpr auto pattern2 = ctll::fixed_string{ "(?<!b)a" }; // Fails return ctre::search<pattern2>(s); } static_assert(a_not_preceded_by_b("xa")); static_assert(!a_not_preceded_by_b("ba"));
Is this a known issue? The lookahead expressions (?=x) and (?!x) seem to work though.
(?=x)
(?!x)
It's not implemented. If you want, send a PR.
@hanickadot Any progress/alternatives?
CTRE doesn't seem to support lookbehind rules, like
(?<=x)
or(?<!x)
.Compiler-explorer / GCC trunk reports a failed assertion in
functions.hpp
:Example:
Is this a known issue? The lookahead expressions
(?=x)
and(?!x)
seem to work though.