telefonicaid / fiware-orion

Context Broker and CEF building block for context data management, providing NGSI interfaces.
https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md
GNU Affero General Public License v3.0
212 stars 265 forks source link

Review regex management in the code #2082

Open fgalan opened 8 years ago

fgalan commented 8 years ago

Currently, we use regex_t in some places (not so much, but needed anyway, e.g. pattern matching for q filters, entity pattern evaluation, etc.). We have had some problem mixing this regex_t (from a C library) with C++ containers in the STL (in particular, as we worked in PR https://github.com/telefonicaid/fiware-orion/pull/2081).

C++ have a std::regex (http://www.cplusplus.com/reference/regex/) that could help. However, first we must ensure that our code works in C++11 (as std::regex was included in that version of C++).

If at the end std::regex doesn't simplify things and we keep regex_t we need to fix some regcomp() calls that are not capturing error properly (we have spotted this https://github.com/telefonicaid/fiware-orion/pull/2081/files#diff-4dffbb65c790f76c51c29cf0ca65c978R80 but a grep for regcomp should be done to ensure that all the others are covered).

crbrox commented 8 years ago

Without migrating to C++11, we have boost:regex available right now and maybe it is good substitute for c++11's regex BOOST 1.41 regex doc