Skip to content
uencoder

Wildcard

Wildcards are simplified pattern-matching characters: * matches any sequence and ? matches a single character; commonly used for file-name and domain matching.

Purpose

Provides the simplest pattern-matching mechanism, suited to non-technical users and simple matching scenarios.

Mechanism

* matches zero or more arbitrary characters; ? matches exactly one arbitrary character. Some implementations support the [] character class. No grouping, no quantifiers, no escaping (or limited escaping). In DNS and certificate SANs, *.example.com matches subdomains.

Use cases

  • DNS wildcard resolution
  • SSL certificate wildcard domains
  • Shell file-name expansion
  • Simple matching in search boxes

Examples

  • Input
    *.example.com
    Output
    Matches a.example.com, b.example.com

    Wildcard domain

Common errors

Wildcard certificates matching multi-level subdomains (a.b.example.com does not match)
Wildcards match a single level only; multi-level subdomains need separate certificates

Related terms

References