Python: Fix false positive for unmatchable dollar/caret

Our previous modelling did not account for the fact that a lookahead can
potentially extend all the way to the end of the input (and similarly,
that a lookbehind can extend all the way to the beginning).

To fix this, I extended `firstPart` and `lastPart` to handle lookbehinds
and lookaheads correctly, and added some test cases (all of which yield
no new results).

Fixes #20429.
This commit is contained in:
Taus
2025-09-19 15:06:46 +00:00
parent c1c0828082
commit 95a84ad655
4 changed files with 64 additions and 29 deletions

View File

@@ -0,0 +1,5 @@
---
category: minorAnalysis
---
- The queries that check for unmatchable `$` and `^` in regular expressions did not account correctly for occurrences inside lookahead and lookbehind assertions. These occurrences are now handled correctly, eliminating this source of false positives.