Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefinition error when switching to std::regex #1158

Closed
xiaoPierre opened this issue Jan 11, 2018 · 2 comments
Closed

Redefinition error when switching to std::regex #1158

xiaoPierre opened this issue Jan 11, 2018 · 2 comments

Comments

@xiaoPierre
Copy link
Contributor

Hello,

I got a problem when trying to switch from rapidjson internal regex to c++11 regex. In the documentation, I found :

For C++11 compiler, it is also possible to use the std::regex by defining RAPIDJSON_SCHEMA_USE_INTERNALREGEX=0 and RAPIDJSON_SCHEMA_USE_STDREGEX=1.

Then I defined these two macros but I got redefinition error :

rapidjson/schema.h:31:0: error: "RAPIDJSON_SCHEMA_USE_STDREGEX" redefined [-Werror]

I investigated in schema.h then I found this part of code which is the cause :

#if !RAPIDJSON_SCHEMA_USE_INTERNALREGEX && !defined(RAPIDJSON_SCHEMA_USE_STDREGEX) && (__cplusplus >=201103L || (defined(_MSC_VER) && _MSC_VER >= 1800))
#define RAPIDJSON_SCHEMA_USE_STDREGEX 1
#else
#define RAPIDJSON_SCHEMA_USE_STDREGEX 0
#endif

When defining RAPIDJSON_SCHEMA_USE_STDREGEX, it will cause redefinition error in the else clause.

I think this code and / or the documentation should be changed.

Regards,
Pierre

@xiaoPierre
Copy link
Contributor Author

Still cannot use std regex
possible fix : #1161

@xiaoPierre xiaoPierre reopened this Jan 11, 2018
@miloyip miloyip closed this as completed Jan 13, 2018
@ivysotskyi
Copy link

having the same issue. No way to switch to std regexp.

the regex I need to check:

"patternProperties": {
    "^(?!sys\\.).*$"

the values:

"some_variable_name"- match
"sys.heart_side" - no match

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants