Glob Pattern Tester

Tool for testing glob patterns

/

    What is Globbing?

    The term "globbing" , is a programming concept that describes the process of using wildcards, for matching file paths.
    For example, the following bash shell command:
    cp *.mp3 ./music
    will copy all files having .mp3 extension to the music folder.
    In that context *.mp3 is the glob pattern and it will match all the files in the current working directory that have .mp3 extension.

    What is this tool?

    This tool visualize glob pattern matching so you can test glob patterns easily.
    Enter an glob pattern in the text field above and all matched files in the file tree will be highlighted in pinks.

    Cheat Sheet

    Glob PatternDescription
    **/images/**/*.{png,svg}Match png and svg files within the images folder and its descendants
    /*.mdMatch md files in the root folder
    *.{js,jsx,ts,tsx,md,html}Match js, jsx, ts, tsx, md and html files in the root folder and its descendants
    **/license.*Match files with the name license - regardless its extension
    **/!(*.min).jsMatch js files in the root folder and its descendants, but dont match min.js files
    **/node_modules/!(vendor)/**.jsMatch js files in the descendants of node_modules except the vendor folder
    /{,!(node_modules)/**/}*.{js,ts}Match ts and js files in all of the folders recursively except node_modules

    About the Glob Pattern Tester

    The Glob Pattern Tester is a free online tool for visualizing and testing glob pattern matching against a file tree structure.
    Glob patterns are wildcard expressions used in programming, command-line tools, and configuration files to match groups of file paths. This tool lets you enter a glob pattern and instantly see which files in a sample directory tree would be matched, with matched files highlighted for clear visual feedback.

    Whether you are writing build tool configurations, setting up file watchers, configuring linting rules, or crafting deployment scripts, this tool helps you verify that your glob patterns target exactly the files you intend before applying them in a real project.

    Key Features

    Understanding Glob Patterns

    Glob patterns, also known as filepath expansion or glob matching, use special wildcard characters to match file and directory paths. They are widely used across programming tools and environments:

    How to Use the Glob Pattern Tester

    1. Enter a Glob Pattern:
      Type your glob pattern into the input field at the top of the page. The default pattern is /src/**/*.ts, which matches all TypeScript files in the src directory and its subdirectories.
    2. Review the File Tree:
      The file tree on the left side highlights all matching files. Matched files are visually distinguished from non-matching ones so you can quickly assess the pattern's behavior.
    3. Edit the File List:
      Switch to the file editor tab on the right side to modify the directory structure. Add new files, remove existing ones, or reorganize the tree to test patterns against different layouts.
    4. Use the Cheat Sheet:
      Browse the cheat sheet tab for common glob pattern examples. Click the play button next to any pattern to load it into the input field and see its matches.
    5. Iterate and Refine:
      Adjust your pattern and observe the changes in real time until the highlighted files match exactly what you need.

    Best Practices

    Common Use Cases

    Frequently Asked Questions

    What glob syntax does this tool support?

    The tool supports standard glob syntax including single asterisk (*), double asterisk (**), question mark (?), brace expansion, and negation patterns. These cover the patterns used by most programming tools and build systems.

    Can I test patterns against my own file structure?

    Yes. The file editor tab allows you to modify the directory tree to match any project layout. You can add, remove, or rename files and folders to create a custom testing environment.

    Is any data sent to a server?

    No. All pattern matching and tree rendering happens entirely in your browser. Your file structures and glob patterns are never transmitted to any external service.

    Why is my pattern not matching the expected files?

    Common issues include missing the leading slash for root-level matching, forgetting to use ** for recursive directory traversal, or not accounting for file extensions. Use the cheat sheet examples as a reference to diagnose matching issues.

    Related Tools

    You might also find these tools useful: