Regex for VS Code and IDE Search/Find simple `var` declarations

Find `var` declarations for modernization review.

Section: Editor Refactor Recipes

Find simple `var` declarations

regex
regex
^\s*var\s+([A-Za-z_$][\w$]*)
Explanation

Helpful in older JavaScript codebases.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Editor Refactor Recipes
Find CommonJS require calls
Find CommonJS imports for migration to ESM.
OpenIn sheetregexsame section
Find 3+ blank lines
Reduce excessive blank vertical spacing.
OpenIn sheetregexsame section
Find repeated spaces
Match runs of multiple spaces.
OpenIn sheetregexsame section
Add commas to object properties
Find non-final object property lines missing a comma.
OpenIn sheetregex1 tag match
Find console logging
Find common `console.log(...)` calls.
OpenIn sheetregex1 tag match
Enable regex mode in search
Use regex search in VS Code find/replace.