-
Notifications
You must be signed in to change notification settings - Fork 281
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
com.google.re2j.PatternSyntaxException: error parsing regexp #156
Comments
Hello, I tried to create a testcase for your problem, but even the JSON parsing fails:
|
Hey sorry, just late night c&p right out
Here is the valid schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"secret": {
"type": "string",
"description": "password",
"maxLength": 512,
"pattern":
"^(?=.*[\\p{L}\\p{N}\\p{Mn}\\p{Pd}\\p{S}\\p{P}\\d])[\\p{L}\\p{N}\\p{Mn}\\p{Pd}\\p{S}\\p{P}\\d]{8,}"
}
},
"required": [
"secret"
]
}
Regards
…On Sat, Mar 24, 2018 at 3:06 AM, Bence Eros ***@***.***> wrote:
Hello, I tried to create a testcase
<76fbc48>
for your problem, but even the JSON parsing fails:
org.json.JSONException: Illegal escape. at 127 [character 24 line 7]
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#156 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIFtdXd-3djzP0icDAxN_ki_Di9f9MFTks5thhrCgaJpZM4S3-W_>
.
|
Can also confirm that I'm having the same issue. The reason seems to be that RE2 does not support lookaheads. However this does raise some issues since the JSON schema spec states that the regex syntax used is ECMA-262 which supports lookaheads. So I'm guessing another regex engine would have to be used to resolve this. |
Change version from 1.8.0 to 1.7.0. It should works fine. |
There will be a new release this week fixing this problem (and also some others), so probably better to wait a bit instead of downgrading. |
The fix is available in the latest release: 1.9.0 |
In the documentation it says:
But if I exclude "re2j" from the pom.xml, and I try to load the schema using
|
I tested with the latest 1.9.0 build.
|
Thanks for reporting it @octavianN . I forgot about |
Issue
Just updated to 1.8.0 and ran into this issue.
re2j does not support lookahead.
this was working around version 1.4.1
Schema
"secret": {
"type": "string",
"description": "password",
"maxLength": 512,
"pattern": "^(?=.*[\p{L}\p{N}\p{Mn}\p{Pd}\p{S}\p{P}\d])[\p{L}\p{N}\p{Mn}\p{Pd}\p{S}\p{P}\d]{8,}"
},
Stack trace
The text was updated successfully, but these errors were encountered: