Shell Glob Pattern Tester

بياناتمطورنص
إعلان · حذف؟
[iotools_shell_glob_pattern_tester]
إعلان · حذف؟

مرشد

Shell Glob Pattern Tester

Shell Glob Pattern Tester

Test glob patterns against a list of file paths and see exactly which paths match — in real time, with semantics for Bash, Zsh, .gitignore, Python fnmatch, and Go path.Match. Type a pattern like src/**/*.{js,ts}, paste paths, and watch matches highlight green and non-matches fade out as you type.

كيفية استخدام

  1. Enter a glob pattern in the Glob Pattern field (for example **/*.log).
  2. اختر Shell / Mode — the same pattern can match different sets of paths depending on whether you are in Bash, .gitignore, Python fnmatch, or Go.
  3. ألصق file paths one per line — or click a built-in example.
  4. Matches highlight green with a check icon; non-matches stay grey. The summary shows the count and a note about the mode you picked.
  5. Prefix your pattern with ! to invert the match (highlight everything that does لا match).

خصائص

  • Five shell modes – Bash (with globstar), Zsh extended_glob, .gitignore, Python fnmatch, and Go path.Match, each with the correct semantics for *, **, ?, and brace expansion.
  • Real-time highlighting – Paths re-evaluate as you type the pattern; no submit button.
  • Brace expansion 0–9 (top row) {a,b,c} alternatives in Bash and Zsh modes, including nesting and cross-products like src/{js,ts}/**/*.{spec,test}.ts.
  • Character classes 0–9 (top row) [abc], [!abc] negated classes, and ranges like [A-Z].
  • Negation – Prefix any pattern with ! to flip the match.
  • Mode notes – A short explanation appears under each result explaining how the chosen mode interprets the pattern.
  • Quick examples – Load a web-project layout, a .gitignore-style log filter, or a docs/Readme example to learn by inspection.
  • من جانب العميل فقط – Patterns and paths never leave your browser; works offline once loaded.

حالات الاستخدام الشائعة

  • Debugging .gitignore rules – Paste a list of paths from git status and see which would be ignored by a candidate rule.
  • Writing build glob arguments – Validate that a pattern fed to tsc, esbuild، أو prettier --write matches the files you expect and nothing else.
  • Authoring CI path filters – Confirm a paths: filter in GitHub Actions or GitLab CI hits the right subset of files before pushing.
  • Translating shell scripts – Verify a pattern still works after porting code between Bash and a Python or Go service.
  • Teaching glob semantics – Show students concretely why * does not cross directory boundaries in Bash but does in fnmatch.

التعليمات

  1. What is the difference between * and ** in a glob pattern?

    A single * matches any characters within a single path segment but does not cross a directory separator (/). The double ** (called globstar) matches any number of characters across any number of directory segments. So src/*.js coinciden src/index.js but not src/utils/index.js, while src/**/*.js matches both. Not every glob dialect supports ** — Python fnmatch and Go path.Match treat the two stars as two separate * tokens.

  2. How is glob matching different from a regular expression?

    Globs are a much smaller pattern language designed for matching file paths. Most characters are literal: *, ?, [...], and (in some shells) {...} are the only metacharacters. There is no quantifier syntax, no anchors, no lookaround, and no backreferences. Implementations typically translate the glob into a regular expression internally, but users do not need to think in regex terms. Glob is intentionally simple so that shell command lines stay short and predictable.

  3. Why does brace expansion not work in all glob dialects?

    Brace expansion ({a,b,c} expanding to three alternatives) is technically a shell feature in Bash and Zsh, evaluated before the glob is matched. The shell pre-expands the brace expression into multiple arguments, and the resulting file globs are matched independently. Pure glob libraries used by tools like git (in .gitignore), Python fnmatch, and Go path.Match do not implement brace expansion because it is not really part of the glob language — it is a separate shell-level pre-processing step.

  4. What does the leading ! mean in a glob pattern?

    The exact meaning depends on context. Inside a character class, [!abc] negates the class — matching any single character except a, b، أو c. As a leading character on a whole pattern, ! is mainly a .gitignore feature where it re-includes a previously ignored path. Most shells do not treat a leading ! on a glob as negation by themselves — they either error out (Zsh history expansion) or pass it through. In this tester, a leading ! is interpreted as a convenience: it inverts the match so unmatched paths highlight green.

هل تريد حذف الإعلانات؟ تخلص من الإعلانات اليوم

تثبيت ملحقاتنا

أضف أدوات IO إلى متصفحك المفضل للوصول الفوري والبحث بشكل أسرع

أضف لـ إضافة كروم أضف لـ امتداد الحافة أضف لـ إضافة فايرفوكس أضف لـ ملحق الأوبرا

وصلت لوحة النتائج!

لوحة النتائج هي طريقة ممتعة لتتبع ألعابك، يتم تخزين جميع البيانات في متصفحك. المزيد من الميزات قريبا!

إعلان · حذف؟
إعلان · حذف؟
إعلان · حذف؟

ركن الأخبار مع أبرز التقنيات

شارك

ساعدنا على الاستمرار في تقديم أدوات مجانية قيمة

اشتري لي قهوة
إعلان · حذف؟