Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegExp substring replace does not work for new Global Search&Replace #9010

Closed
nsgundy opened this issue Jul 9, 2016 · 3 comments
Closed
Assignees
Labels
feature-request Request for new features or functionality search Search widget and operation issues
Milestone

Comments

@nsgundy
Copy link

nsgundy commented Jul 9, 2016

  • VSCode Version: 1.3.0
  • OS Version: Win10

Steps to Reproduce:
File contents:

let fs = require('fs');
  1. Start Global Search&Replace CTRL+SHIFT+H
  2. For the search term use let\s+(\w+)\s*=\s*require\s*\(\s*['"]([\w\.\-/]+)\s*['"]\s*\)\s*;
  3. For the replace term use import * as $1 from '$2';

Issue:

When replacing, the file looks like this:

import * as $1 from '$2';

Expected

import * as fs from 'fs';

Note: This works using Local Search&Replace (CTRL+H).

@sandy081 sandy081 added search Search widget and operation issues feature-request Request for new features or functionality labels Jul 11, 2016
@sandy081 sandy081 added this to the July 2016 milestone Jul 11, 2016
@sandy081
Copy link
Member

Replace text does not yet support taking groups arguments from search text. But I agree this is a parity issue with local find. Will try to get this soon. Thanks

@sandy081
Copy link
Member

FYI @egamma Pushed this and will be available in tomorrow's insiders build.

@iFwu
Copy link

iFwu commented Dec 6, 2016

I hope the replace term $& can be supported, which is just the word it matches. I know I can do this by grouping the search word with brackets(like ([^\s])), and make the replace term like $1, but it's more troublesome. Thanks. @sandy081

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality search Search widget and operation issues
Projects
None yet
Development

No branches or pull requests

3 participants