Skip to content

Wildcard Masks

Wildcard mask is a string that contains special characters for pattern matching, whereby:

A question mark (?) can represent a single character;

An asterisk (*) represents any sequence of characters (including zero character);

A string in brackets ( [string] ) matches exactly one character that is a member of the character set defined by the string. The string may contain ranges, which consist of two characters with a dash between them. You can negate a character set by placing a {!} or a {^} immediately after the opening bracket.

Below are some examples of wildcard masks:

*.html- file names ending with .html (HTML files)

*.exe- file names ending with .exe (applications)

a???.html- file names begin with 'a', followed by any three characters and ".html"

a[A-Z]ch.zip- the second character of the file name is an uppercase letter

[!0-9]any.mp3- the first character of the file name is NOT a number