Wayne Li
Wayne Li

Reputation: 421

regexr in json file

I'm reading the article Debugging ES6 in Visual Studio Code and find a syntax in launch.json file that I don't quite understand.

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch App.js",
      "program": "${workspaceRoot}/src/app.js",
      "outFiles": [ "${workspaceRoot}/.compiled/**/*.js" ]
    }
}
 "outFiles": [ "${workspaceRoot}/.compiled/**/*.js" ]

What does the ** (two stars) represent? Also, does *.js match filname.js.map beside matching filename.js? I am not sure if this kind of pattern relates to regexr.

Upvotes: 0

Views: 87

Answers (2)

Serg
Serg

Reputation: 1367

This is not a regex (because dot in ".js" does not look like it matches any character).

This is kind of fancy wildcard for a filename:

  1. ${workspaceRoot} - some environmental variable
  2. /.compiled - exact name of folder (e.g. for generated code)
  3. /** - any set of nested folders
  4. /*.js - any file with js extension at path specified before

Also, does *.js match filname.js.map beside matching filename.js?

I assume that it does not, only filename.js.

Upvotes: 2

mankowitz
mankowitz

Reputation: 2053

the ** (double-glob) means that it will search in any number of subdirectories. For example,

a/**/b

will match

a/a/b

a/c/b

a/c/a/b

and so on.

Upvotes: 1

Related Questions