rector
rector copied to clipboard
Incorrect behavior of RegexDashEscapeRector
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.org/demo/f7c15ce4-8dbe-4f79-bd1e-88c7a9d10c3c
<?php
preg_match('/[\-\w]/');
Responsible rules
-
RegexDashEscapeRector
Expected Behavior
Rector should skip updating this code
Regex101.com interpretation of code
Pre-change PCRE:
Pre-change PCRE2:
Post-change PCRE:
Post-change PCRE2:

Hi, thank you for your detailed report and demo link!
Could you send a failing test case in a pull-request, so we have it covered in Rector? You can click "Create a Test" button at demo page.
@TomasVotruba done https://github.com/rectorphp/rector-src/pull/2753