-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Capturing group in search/replace #991
Comments
My guess is this is some consequence of the regex engine we're using, which is Javascript's, not Vim's. |
@johnfn that explains |
vscode's built in search support group capturing, can we use that? |
Unfortunately, I doubt it, because it's highly unlikely that VSCode's capturing works in the same way as Vim's. |
You can use vscode's built-in search support for group capturing... You just need to use JS syntax instead. From the example in the original question, just use:
While I am a huge vi fan, I really dislike their regex syntax. To me, the JS syntax feels cleaner (not so many The only negatives I have encountered are:
|
This is added with the new "enableNeovim" option (on master). |
I might also add here that the whole match character, '&' in vim, is actually '$&' in JS. I found this out through trial and error. |
Please thumbs-up 👍 this issue if it personally affects you! You can do this by clicking on the emoji-face on the top right of this post. Issues with more thumbs-up will be prioritized.
What did you do?
In a document containing the string
some test text
run the command
:%s/te\(.\)t/\1/g
Put the exact keys you pressed.
:
to open the vim command prompt, type in%s/te\(.\)t/\1/g
and hit the Enter key.What did you expect to happen?
some test text
to be replaced withsome s x
What happened instead?
Nothing
Technical details:
The text was updated successfully, but these errors were encountered: