在 Visual Studio Code 中查找并替换为换行符 [英] Find and replace with a newline in Visual Studio Code

查看:144
本文介绍了在 Visual Studio Code 中查找并替换为换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Linux Fedora 环境中试用新的 Microsoft Visual Studio Code 编辑器.我想知道如何替换新行 (\n) 来代替其他一些文本.

I am trying out the new Microsoft Visual Studio Code editor in Linux Fedora environment. I would like to know how to replace new line (\n) in place of some other text.

例如,我有这样的 html 文本

For example, I have html text like this

<tag><tag> 

我想替换为

<tag>
<tag>

在 sublime 中,我会使用正则表达式模式并找到 "><" 并替换为 ">\n<" 我如何在 Visual Studio Code 中完成此操作?

In sublime I would use regex pattern and find "><" and replace with ">\n<" How do I accomplish this in Visual Studio Code?

推荐答案

在本地搜索框 (ctrl + f) 中,您可以按 ctrl 插入换行符 + 输入.

In the local searchbox (ctrl + f) you can insert newlines by pressing ctrl + enter.

如果您使用全局搜索 (ctrl + shift + f),您可以按 shift 插入换行符> + 输入.

If you use the global search (ctrl + shift + f) you can insert newlines by pressing shift + enter.

如果您想按字符字面量搜索多行,请记得检查最右边的正则表达式图标.

If you want to search for multilines by the character literal, remember to check the rightmost regex icon.

在以前版本的 Visual Studio 代码中,这很困难或不可能.旧版本要求您使用正则表达式模式,旧版本尚不支持任何换行搜索.

In previous versions of Visual Studio code this was difficult or impossible. Older versions require you to use the regex mode, older versions yet did not support newline search whatsoever.

这篇关于在 Visual Studio Code 中查找并替换为换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆