`metavariable-pattern` with `pattern-regex` doesn't match `_`
sim642 opened this issue · comments
Simmo Saan commented
Describe the bug
metavariable-pattern
with pattern-regex
doesn't match _
, while metavariable-regex
with the same regex
does.
The former also produces:
Internal matching error when running try-catch-all-bug on target.ml:
An error occurred while invoking the Semgrep engine. Please help us fix this by creating an issue at https://github.com/returntocorp/semgrep
metavariable-pattern failed because $E does not bind to a sub-program, please check your rule Engine(MatchingError)
To Reproduce
Doesn't work: https://semgrep.dev/playground/s/L1qv9.
Works: https://semgrep.dev/playground/s/8GNPq.
Expected behavior
_
is matched in both cases, regardless of metavariable matching syntax.
What is the priority of the bug to you?
- P0: blocking your adoption of Semgrep or workflow
- P1: important to fix or quite annoying
- P2: regular bug that should get fixed
Use case
Write rule for catch-all exception handlers, regardless of whether they use a wildcard or an identifier.