-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add a new selector type: regex selector #519
Comments
Hey there @He-Pin. We actually have some support for that in the RFC. There are two regex functions,
Both use a flavor of regex called i-regexp, which was developed to be a compatible subset of most commonly used regex engines. |
I checked that but seem will not match our usage. {
"data": {
"header_1": {
"a": "1",
"b": "2",
"body": "{\"c\":\"3\"}"
},
"header_2": {
"a": "1",
"b": "2",
"body": "{\"c\":\"3\"}"
}
}
} background: we want to select some json fields for translation. tried java jsonpath implementation. as the json above, we want to select the fields I was using regexSelector: then I can write as you can see, the main point here we are select on object children's property name |
Oh, you want the property names to be matched, not the values. That, I think is likely going to be covered by #516, which is the piece you're missing. Once you can access the property names, you should be able to pass them into the functions. |
I think we need the pointer to the child property name, maybe |
@gregsdennis as #109 , I have implemented this with a new selector |
@He-Pin it's great that you've been able to implement it, but be aware that because it's not a standard behavior, it's not interoperable. We'll leave this open as an idea for a possible JSON Path v2, but there's no such discussion at the moment. Continuing to push this idea in the short term isn't going to make that happen any faster. |
Understand , as it's an internal needs, which should be fine. |
Another aspect of adding a regex selector is that there's no way to specify what kind of matching you want, which is why we have |
Yes, as it's a valid name too. but the name selector is inside |
We have some fields in object/array , which is generated by backend, with name
header_$id
, I would like to select it with regex.The text was updated successfully, but these errors were encountered: