Skip to content

match + regex combination is not working as expected for properties started or containing '@' #154

Description

@asatarov

Describe the bug

if JSON key contains '@' symbol, match operation with regexp doesn't work as expected

Code sample or steps to reproduce

example json:

{
"definitions": {
"product": {
"title": "product",
"type": "object",
"properties": {
"@productId": {
"type": "string"
},
"@baseProperty": {
"type": "string"
},
"baseProperty@": {
"type": "string"
},
"base@Property": {
"type": "string"
},
"otherProperty": {
"type": "string"
},
"anotherProperty": {
"type": "string"
}
}
}
}
}

search results:

queryresultexpected result
$.definitions.*.properties[?(@property.match(/@/))]~["baseProperty@","base@Property"]["@ProductID", "@baseProperty", "baseProperty@", "base@Property"]
$.definitions.*.properties[?(@property.match(/\x40/))]~["baseProperty@","base@Property"]["@ProductID", "@baseProperty", "baseProperty@", "base@Property"]
$.definitions.*.properties[?(@property.match(/Property/))]~["baseProperty@","base@Property","otherProperty","anotherProperty"]["baseProperty@","base@Property","otherProperty","anotherProperty", "@baseProperty"]
$.definitions.*.properties[?(@property.match(/o/))]~["baseProperty@","base@Property","otherProperty","anotherProperty"]["baseProperty@","base@Property","otherProperty","anotherProperty", "@ProductID", "@baseProperty"]
$.definitions.*.properties[?(@property.match(/base/))]~["baseProperty@","base@Property"]["baseProperty@","base@Property", "@baseProperty"]

Expected behavior

regex should work correctly with '@' symbols (e.g. as it works in https://regex101.com/)

Expected result

see table above

Environment (IMPORTANT)

https://extendsclass.com/jsonpath-tester.html

Desktop**

https://extendsclass.com/jsonpath-tester.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions