1. Find all relevant boundaries (^, $, \A, \Z, \z) in the regex using a visitation of the AST.
2. For each boundary check whether it can reach the end-of-the-regex state without consuming input using the linked helper method.
3. If it can't, report an issue.
Compared to the current implementation of S5840 this will avoid false positives if the boundary is nested inside other syntactic constructs (like in a look around).
- contributes to
-
MMF-2182 Help Java developers writing regexp running fast, with the correct amount of resources and really doing what developers intended
-
- Resolved
-
- depends upon
-
SONARJAVA-3549 Add support for automata-based analyses for regular expressions
-
- Closed
-
-
SONARJAVA-3551 Implement helper to find whether state in regex automaton is reachable without consuming input
-
- Closed
-
- implements
-
RSPEC-5996 Regex boundaries should not be used in a way that can never be matched
- Active