rector icon indicating copy to clipboard operation
rector copied to clipboard

Incorrect behavior of RegexDashEscapeRector

Open ebrigham1 opened this issue 3 years ago • 2 comments

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_pcre Pre-change PCRE2: pre_change_pcre2 Post-change PCRE: post_change_pcre Post-change PCRE2: post_change_pcre2

ebrigham1 avatar Aug 10 '22 14:08 ebrigham1

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 avatar Aug 10 '22 15:08 TomasVotruba

@TomasVotruba done https://github.com/rectorphp/rector-src/pull/2753

ebrigham1 avatar Aug 10 '22 17:08 ebrigham1