Your everyday regex environment
VS Code's Find & Replace (Cmd/Ctrl+F for current file, Cmd/Ctrl+Shift+F for project-wide) supports regex when you toggle the .* button (or press Alt+R).
The flavor is JavaScript-style RegExp — most patterns from the JS lesson work directly.
Replacement syntax
Use $1, $2... for capture groups in the replacement field. $0 is the whole match. Named groups: $<name>.
Special replacements:
\n— newline (insert a line break)\t— tab\u$1— uppercase the first character of group 1\U$1— uppercase entire group 1\l$1— lowercase the first character of group 1\L$1— lowercase entire group 1
The case modifiers are killer
Convert userName to USER_NAME: find ([a-z])([A-Z]), replace with $1_$2, then a second pass: find (\w+), replace with \U$1. Two passes, code modernized.
Other VS Code regex superpowers
- Multi-line mode: Toggle the multi-line button (or press
Ctrl+Enterin find box). Now\nmatches newlines and you can match across lines. - Files to include/exclude: Restrict the search scope without writing complex shell commands.
- Preserve case: Toggle to make replacements respect the original case (camelCase stays camelCase, etc.).