Skip to content

Preserve regex syntax in case-insensitive DeepSearch - #631

Closed
Eric3-jp wants to merge 1 commit into
qlustered:devfrom
Eric3-jp:fix-search-regex-case
Closed

Eric3-jp wants to merge 1 commit into
qlustered:devfrom
Eric3-jp:fix-search-regex-case

Conversation

@Eric3-jp

Copy link
Copy Markdown

DeepSearch(['ABC', '123'], r'\D+', use_regexp=True) currently reports root[1]: its default case-insensitive handling lowercases the pattern, turning \D into \d. The same problem affects other uppercase regex escapes and scoped case-sensitive groups, including searches of dictionary paths.

Preserve the regex pattern and the text it searches, and use re.IGNORECASE for case-insensitive matching. Literal string searches retain their current handling. Tests cover uppercase escapes, named Unicode characters, scoped inline flags, dictionary paths, and explicit case sensitivity.

Validation on Python 3.12.3:

  • Before the fix, 8 new regression cases failed and 8 controls passed; after the fix, all 78 search tests passed.
  • Broader tests, including slow tests: 1,230 passed and 8 skipped. The ordinary serialization tests passed separately: 90 passed. Security-specific tests were excluded from these runs.
  • search.py reached 100% coverage in the broader suite.
  • pyright deepdiff/search.py: no errors or warnings.
  • CI's blocking Flake8 selection and git diff --check: passed.

Prepared with OpenAI Codex assistance for implementation, regression tests, and review.

@Eric3-jp Eric3-jp closed this by deleting the head repository Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant