VS Code Regex find and replace with lowercase, use \l or \L if possible

前端 未结 2 1029
[愿得一人]
[愿得一人] 2020-12-18 20:12

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 reg

2条回答
  •  眼角桃花
    2020-12-18 20:51

    • Press Ctrl + F
    • Select .* button and enter your RegEx
    • Press Ctrl + Shift + L (Select All)
    • Press Ctrl + Shift + P
    • Choose Transform to Lowercase

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

    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.

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

    • Click somewhere in the file
    • Press Ctrl + Shift + L (Select All)

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

提交回复
热议问题