格 千格 KiloCell

Glob Mode Tester

Configure and Test

Enter mode to see syntax description...

Match Results

Total: 0
Match: 0
Not matched: 0
Please enter a path to start testing
Rapid Syntax References
* Match any character of the current directory
** Cross directory matching any level
? Match any character in a single character
{a,b} Match a or b options
[a-z] Match Character Range
!(x) Dismisss matching specific mode

In-depth understanding of the Glob model and its application in development

The Glob (Global) model is a simplified regular expression syntax, originally used for Unix Shell Matches the file path. Now it's an integral part of the modern Web development tool chain, and it's used extensively. Webpack, Gulp, ESLint, Prettier, VS Code and types of CI/CD profiles (e. g. .gitignore and GitHub Actions I'm not sure.

Why use the Glob test tool?

In complex project structures, it is extremely challenging to develop precise path matching rules. Common pain points include:

  • Error matching sensitive files: A mistake. **/*.js It could be accidental to include node_modules or production environment secrets.js It leads to slow construction and even security loopholes.
  • The exclusion rule is invalid: ! Negative mode is different (e.g. picomatch vs minimatch There are minor differences in behaviour in the ) which result in the configuration not being effective.
  • Retrogressive performance bottlenecks: Overuse ** This will result in the scanning of tens of KiloCell of unrelated documents, significantly slowing down the CI/CD process.

Our online tester passed. picomatch Engine (one of the most efficient current Glob resolutionrs) provides real-time feedback matching to help you to apply the configuration before it is refined.

Specific scenes to be addressed

Scenario one: Configure the Lint rules.
You wish. src All of it. .js and .ts File check, but exclude all by .test. . You can test mode: src/**/!(*.test).{js,ts} 。

Scenario 2: Webpack entrance scan.
Pass. **/*.entry.js Automatically discover all entry files to ensure that pages under the embedded directory are properly packed.

Scenario 3: CI/CD cache path.
Configure in GitHub Actions cache Path, make sure you only cache package-lock.json is the directory where you want to avoid the cache of redundant data.

Glob core grammar details

  1. * (Single asterisk): Matches any number of characters in a single path segment. For example: *.js Match app.js , but not matched src/app.js 。
  2. ** (Dual asterisk): Matches zero or more directories. For example: src/**/*.js Depth recursively. src Below all JavaScript files.
  3. {} (Bracketed): to create an extension group. {js,ts} Match js or ts Suffix.
  4. [] (in parentheses): Matches the character set. [0-9] Matches any digital bit.
  5. ! (Exclaims): For taking the reverse. Note that in many cases, the counter-model usually needs to be placed at the end of a list or as a separate rule.

How to use this tool?

1. Input mode: Enter your Glob rule in the left input box. Tools will automatically parse and generate human-readable syntax descriptions for you.

2. List path: Pastes your project document structure (parts) to the bottom text box. The proposal contains some critical paths that you want to match and exclude.

3. Observation feedback: The right side displays results in real time through the green (match) and grey (not match) labels and counts the hit rate.

4. Share: Click on the Sharing Test to generate encrypted links with the current configuration to facilitate discussion or recording of the configuration with colleagues.

Copyed