Rule S6328: Replacement strings should reference existing regular expression groups

Description

RSPEC PR: https://github.com/SonarSource/rspec/pull/654

The rule should raise whenever a reference to a nonexistent group is made in the $replacement argument passed to preg_replace().

To note:
The backreferences can be of the form \n, $n, or ${n}. Where n is the group we are referring to.
Named backreferences do not seem possible. However, named groups can still be referenced to by their number.

100% Done
Loading...

Activity

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Labels

Fix versions

Priority

Sentry

Created December 9, 2021 at 10:46 AM
Updated October 16, 2024 at 2:37 PM
Resolved January 28, 2022 at 9:04 AM