Skip to content

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

Closed

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).

Activity

  1. added a commit that references this issue on Dec 2, 2024
    a72bc83
  2. added
    bug
    on Dec 2, 2024
  3. added a commit that references this issue on Dec 2, 2024
    6ad0532
  4. jg-rp commented on Dec 2, 2024

    @jg-rp
    Owner

    Thank you, @emaheuxPEREN, for reporting this issue.

    Should be fixed in version 1.2.1. Now released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions