diff --git a/src/regex_impl.cc b/src/regex_impl.cc index 99b56528..948cd50a 100644 --- a/src/regex_impl.cc +++ b/src/regex_impl.cc @@ -186,9 +186,11 @@ private: case '[': ++m_pos; return character_class(); + case '|': case ')': + return nullptr; default: - if (contains("^$.*+?()[]{}|", cp)) - return nullptr; + if (contains("^$.*+?[]{}", cp)) + parse_error(format("unexpected '{}'", cp)); ++m_pos; return new_node(ParsedRegex::Literal, cp); }