Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code Glob pattern optional single character

Using the VS Code "files to include" feature in search, I'd like to search for any Javascript file within a folder, including [.js, .ts, .jsx, .tsx] but not .json. I can already to this with 2 separate searches:

./theFolder/**/*.[tj]s, ./theFolder/**/*.[tj]sx

Is there a way to do it with just one, like it would be in Regex?

./theFolder/**/*.[tj]sx? // ? doesn't do that in vscode glob

Also see https://code.visualstudio.com/docs/editor/glob-patterns

like image 761
Isaiah Shiner Avatar asked Nov 18 '25 15:11

Isaiah Shiner


1 Answers

At the time of this writing, there's no single-optional-character matching feature.

But you can still make what you're doing less verbose by using {} to group conditions. Ex. ./theFolder/**/*.[jt]{s,sx}.

For docs, in addition to https://code.visualstudio.com/docs/editor/glob-patterns, see also https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options

like image 157
starball Avatar answered Nov 21 '25 09:11

starball