VS Code Regex 查找并替换为小写,如果可能,请使用 \l 或 \L [英] VS Code Regex find and replace with lowercase, use \l or \L if possible

查看:35
本文介绍了VS Code Regex 查找并替换为小写,如果可能,请使用 \l 或 \L的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法用小写字符查找和替换(正则表达式)匹配字符串中的所有大写字符?最好使用 VS Code 或 IntelliJ我已经准备好了我的正则表达式.

Is there a way to do a find and replace (regex) all uppercase characters in the matching strings with lowercase ones? Preferably in VS Code or IntelliJ I already have my regex ready.

明确地说,我已经知道谁可以找到匹配项.但是寻找该功能以将所有大写匹配替换为小写匹配

To be clear I already know who to find the matches. But looking for that function to replace all uppercase matches with lowercase ones

推荐答案

  • Ctrl + F
  • 选择 .* 按钮并输入您的 RegEx
  • Ctrl + Shift + L (Windows) 或 Cmd + Shift + L (Mac) 选择所有匹配的结果
  • Ctrl + Shift + P (Windows) 或 Cmd + Shift + P (Mac)
  • 选择转为小写
    • Press Ctrl + F
    • Select .* button and enter your RegEx
    • Press Ctrl + Shift + L (Windows) or Cmd + Shift + L (Mac) to select all matched results
    • Press Ctrl + Shift + P (Windows) or Cmd + Shift + P (Mac)
    • Choose Transform to Lowercase
    • 如果你只想修改匹配文本的一部分,你必须多做 1 步.

      If you want to modify only part of the matching text you have to do 1 step extra.

      如果您在查找"对话框中按 Ctrl + Shift + L,它会选择完整匹配的文本,但您不能移动 (multi) 光标并进行部分选择.

      If you press Ctrl + Shift + L in the Find dialog it selects the full matching text but you can't move the (multi) cursors and make a partial selection.

      输入正则表达式后,VSC 将显示哪些部分与查找匹配.

      After entering the regex, VSC will show you which parts will match the find.

      • 点击文件中的某处
      • Ctrl + Shift + L(全选)
      • Click somewhere in the file
      • Press Ctrl + Shift + L (Select All)

      • Alt + Enter(在查找"对话框中)

      现在您可以移动(多)光标并进行部分选择并应用所需的变换.

      Now you can move the (multi) cursors and make a partial selection and apply the needed transform.

      这篇关于VS Code Regex 查找并替换为小写,如果可能,请使用 \l 或 \L的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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