Toolvito

Works on this device

Wildcard Tester

Enter a wildcard pattern and a list of names. The tool shows which names match and, for the others, the place where the match stops. The names are text only; no file on your device is opened.

Pattern and names

The wildcard pattern to test. It is used on this device only.

File names, paths or other text. Each line is tested by itself. No file is opened.

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Enter a pattern and some names, or choose Try an example.

How to use this tester

  1. Enter the pattern, such as *.txt.
  2. Choose the dialect: the program or system whose wildcard rules you want.
  3. Enter the names to test, one on each line.
  4. Read the table. Each name shows Match or No match, and for no match the reason.
  5. Choose Copy matches to copy the names that match, or Download CSV for the whole table.

The four dialects

Wildcard rules in each dialect
Dialect Wildcards Notes
POSIX shell glob * any text, ? one character, [abc] one of a set, [a-z] a range, [!abc] not in the set, [[:digit:]] a named class Capital and small letters are different. A backslash makes the next character normal. A wildcard does not match a slash, and a name that starts with a dot needs a dot in the pattern.
Glob with ** The same, and ** for whole folder names at any depth Used by .gitignore files and many build tools. Inside brackets, ! or ^ means not.
Windows wildcards * any text, ? exactly one character Capital and small letters are the same. No brackets and no escape character.
Excel wildcards * any text, ? exactly one character, ~ before a real *, ? or ~ Capital and small letters are the same. The whole text must match.

How ** works

  • ** counts only when it is a whole part between slashes. In a**b the two stars are read as one *.
  • **/name matches name in the top folder and in any folder below it.
  • a/**/b matches a/b, a/x/b, a/x/y/b and so on.
  • a/** matches everything inside a, but not a itself.
  • A pattern with no slash, such as *.log, is tested against the last name of a path, as a .gitignore file does. You can turn this off.
  • A slash at the end of the pattern means folders only. Put a slash at the end of a name to say that it is a folder.

Worked example

With the pattern report-??-*.[ct]sv in the POSIX dialect, the names report-01-final.csv and report-02-draft.tsv match. The name report-3-final.csv does not: at character 10 it has f, but the pattern needs - there, because ?? stands for exactly two characters. The name report-10-old.csv.bak does not match because the pattern ends after character 17 and the name goes on. Report-04-x.csv fails at character 1, because capital and small letters are different.

The same rule as a regular expression is ^report-[^\/][^\/]-[^\/]*\.[ct]sv$.

Limits you should know

  • Old Windows commands such as dir have odd cases that the plain Windows rule here does not copy. There, *.* also matches a name with no dot, a ? at the end can match no character, and short names in the 8.3 form can match too.
  • For .gitignore files only one pattern is tested. A file with many patterns has more rules: a line that starts with ! brings files back, and a folder that matches also covers everything inside it.
  • In the POSIX dialect only ! means not inside brackets. Some shells, such as bash, also read ^ as not.
  • Named classes such as [[:alpha:]] cover ASCII letters only. A real shell uses the language setting of the system.
  • Excel functions differ: COUNTIF and XLOOKUP compare the whole cell, but SEARCH looks for the pattern anywhere in the text.
  • The regular expression is given as text for use in other tools. It is written for a regular expression engine with look-ahead, such as JavaScript or Python.
  • The tool takes a pattern of up to 1,000 characters and up to 2,000 names. The page shows the first 500 rows; the CSV file has every row.

Related tools