wildcard : Java Glossary

go to home page W words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish by Roedy Green ©1996-2009 Canadian Mind Products
index page for letter ⇒ punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
wildcard
In Windows BAT language you can refer to all files in a directory as *.html or all files a?.html for all two-letter files starting with a. The way you specify such a group of files is called a wildcard. * matches any string. ? matches any single character.

Windows

Using cmd.exe as the command processor, or Take Command 4nt.exe, wildcards behave in a way that may surprise you.

IntelliJ Idea under Windows

Using the IntelliJ Idea IDE to run programs, wildcards behave in a way that may surprise you.

Bash under Linux

Using bash as the script processor, wildcards behave in a way that may surprise you. I am also told in Linux/bash you can subvert the globbing with \ quoting, e.g. \*.html Then your program will get the command-line parameters unexpanded. See parameter expansion in bash for more details.

Experiment!

It is probably easier to understand this by experiment than by explanation. Here is a simple tool to help you.

Converting Wildcards to Regexes

You can convert a wild card to a regex, then do you own filtering.

Summary

This wildcard expansion mechanism is Mikey Mouse. It does not work for wildcards containing spaces. It is confusing for wildcards without matches. It makes it difficult to pass * or ? as data. I think the best way out is for Sun to provide an alternate mechanism to passing the entire command line completely unmodified.

CMP homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.58]
You are visitor number 8,336.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/wildcard.html J:\mindprod\jgloss\wildcard.html