Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Replacing in the project uses the captured groups of the first match in all cases #1136

@msoutopico

Description

@msoutopico

Prerequisites

Description

When batch-replacing parts of the text matched by a regular expression which captures some groups, the captured groups of the first instance are used in all occurrences, instead the groups captured in each occurrence. The issue only happens when finding in the project.

Steps to Reproduce

  1. Have a text file that includes several strings with a common part, e.g. "000".
  2. Press Cmd+Shift+F to launch replace menu in the project (to replace in all files)
  3. Search for something like (.+)000(.+), where the non-captured part is to be removed.
  4. Replace with $1$2 so as to replace the whole matched string with the captured groups (thus removing the common non-captured part).

Expected behavior:

In every occurrence, the text matched is replaced with the groups captured in that occurrence.

Actual behavior:

In every occurrence, the text matched is replaced with the groups captured in the first occurrence. https://youtu.be/d7I5Y4-jaOs

IMAGE ALT TEXT HERE

Reproduces how often:

Every time.

Versions

Atom : 1.51.0
Electron: 5.0.13
Chrome : 73.0.3683.121
Node : 12.0.0

apm 2.5.0
npm 6.14.5
node 10.20.1 x64
atom 1.51.0
python 2.7.16
git 2.11.0

Mac OS X: 10.13.6 (17G14019)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions