wildcard : Java Glossary

wildcard
In Windows BAT (Batch) 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 tcc.exe, wildcards behave in a way that may surprise you.

IntelliJ Idea under Windows

Using the IntelliJ Idea IDE (Integrated Development Environment) 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

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 You can get the freshest 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
logo
Please email your , letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email. If you want your message, your name or email kept confidential, not considered for public posting, please explicitly specify that. Unless you state otherwise, I will treat your message as a letter to the editor that I may or may not publish in the feedback section. After that, it will be too late to retract it. If you disagree with something I said, please quote it and cite the web page where you found it, tell me why you think it is wrong, and, if possible, provide some supporting evidence. Threatening to kill me or spouting obscenities has yet to persuade me to change my mind.
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.179.211]
You are visitor number 12,281.