Skip to content

exclude_regex_paths does not work correctly with regular expressions including $ #471

Open
@GroundWalker7

Description

@GroundWalker7

Describe the bug
The parameter exclude_regex_paths does not work correctly with regular expressions including $
When I check the source code, I found the following code in diff.py line 481:

elif self.exclude_regex_paths and any(
[exclude_regex_path.search(level_path) for exclude_regex_path in self.exclude_regex_paths]):
skip = True

and the level_path will be like root['createTime']
So, if I want to match paths ending with time when using exclude_regex_paths, I have to use (?i).*time']$ or something like that.

To Reproduce
DeepDiff({"aTimea": 1}, {"aTimea": 2}, exclude_regex_paths=["(?i).*time$"])
and still get diff: {'values_changed': {"root['aTimea']": {'new_value': 2, 'old_value': 1}}}

OS, DeepDiff version and Python version (please complete the following information):

  • Python Version [3.12.2]
  • DeepDiff Version [7.0.1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions