Skip to content

Bad serialization of anti-slash in regexps with /.../ syntax #70

@emaheuxPEREN

Description

@emaheuxPEREN

Using version 1.2.0

import jsonpath

jp = jsonpath.compile(r"$[?@ =~ /\d/]")
assert jp.findall(["", "1", "10"]) == ["1"]  # OK

assert str(jp) == r"$[?@ =~ /\d/]"  # NOK: "\d" --> "d"

jp_from_str = jsonpath.compile(str(jp))
assert jp.findall(["", "1", "10"]) == ["1"]  # NOK

Note that behavior is OK with r"$[?match(@, '\\d')]" (but anti-slash needs to be escaped).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions