getml / reflect-cpp

A C++20 library for fast serialization, deserialization and validation using reflection. Supports JSON, BSON, CBOR, flexbuffers, msgpack, TOML, XML, YAML / msgpack.org[C++20]
https://getml.github.io/reflect-cpp/
MIT License
783 stars 63 forks source link

Compile error when using - in regex (sometimes) #107

Open merisanualex opened 1 month ago

merisanualex commented 1 month ago

Hi, I believe I found a bug in Pattern, I expect that all 3 of these would compile fine but 3rd one seems to give a compile time error saying "Regular Expression contains syntax error":

rfl::Pattern<R"(-)", "first"> first; // works
rfl::Pattern<R"([\-])", "second"> second; // works
rfl::Pattern<R"([-])", "third"> third; // error
liuzicheng1987 commented 1 month ago

@merisanualex , we are using an external library for that, CTRE:

https://github.com/hanickadot/compile-time-regular-expressions

Could you maybe ask them about this issue?