Search code examples
visual-studio-codeintellij-15

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


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.

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


Solution

    • 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

    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)

    or

    • Press Alt + Enter (in the Find dialog)

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