Wildcard (computer science)

from Wikipedia, the free encyclopedia

Wildcard (from the English wildcard , a playing card in poker ), Joker (after Joker , a playing card) or placeholder denotes a placeholder for other characters in the computer area. This concept is often referred to as globbing or truncation .

more details

Many command line interpreters and other programs allow the use of such placeholders, for example, to address groups of files that have similar names. Search functions in text editors also know such placeholders. Furthermore, search engines such as B. Google or website-internal search functions such. B. in Wikipedia with it.

Frequently used placeholders are:

  • the question mark ( ?) for exactly one character
  • the underscore ( _) for exactly one character
  • the asterisk ( *) for any number of characters (including zero)
  • the percent sign ( %) for any number (including zero) characters
  • the pound# sign ( ) for a numeric value.

A search for ?ausfinds all strings that end in from and have any character in front of it; Examples would be house , house , mouse and out . The search for *aus, on the other hand, also delivers something out and out .

Some programs, such as POSIX -compatible UNIX - shells , and programming languages expand the wildcard principle to regular expressions , which allow, among other several characters at one point: These brackets are used. So stands [BfN]ettfor the three words bed , bold and nice and Schmi[dt]tfor Schmidt or Schmitt .

The database language SQL uses the underscore ( _) as a placeholder for a character and the percent sign ( %) as a placeholder for any number of characters.

Type any number of characters exactly 1 character exactly 1 digit special character
SQL (LIKE) %, *( Access ) _, ?( Access ) [%]finds % , [_]finds _ , [[]finds [ , []]finds ]
Open SQL (ABAP / SAP) (CP, NP, SE16) * + #*finds * , #+finds + , ##finds #
Regular expressions .* . \d see Regular Expressions in Practice

See also

literature

  • Ulrich Hedtstück: Introduction to Theoretical Computer Science: Formal Languages ​​and Automata Theory . Munich 2012, ISBN 978-3-486-71404-3 , Chapter 3.12: Wildcards