Inferensys

Glossary

Wildcard Matching

A robots.txt pattern-matching feature using the '*' character to represent any sequence of characters, enabling a single rule to apply to a broad range of URLs.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
PATTERN EXPANSION

What is Wildcard Matching?

A mechanism in the Robots Exclusion Protocol that uses the '*' character as a multi-character wildcard to apply a single directive to a broad, variable range of URL paths.

Wildcard Matching is a pattern-matching feature in robots.txt that uses the * character to represent any sequence of characters, including an empty string. This allows a single Disallow or Allow directive to target a dynamically generated set of URLs without needing to list every specific path, simplifying rule management for large sites.

According to RFC 9309, a wildcard matches zero or more valid path characters but does not match the query string delimiter ?. For example, Disallow: /*.pdf blocks all PDF files site-wide, while Allow: /public/*/index.html grants access to index files within any subdirectory of /public/, demonstrating granular path matching control.

ROBOTS.TX PATTERN SYNTAX

Key Features of Wildcard Matching

Wildcard matching is a core mechanism of the Robots Exclusion Protocol that enables efficient, scalable access control. By using the * character to represent any sequence of characters, a single directive can govern entire directory trees, dynamic parameter spaces, or file type patterns without requiring exhaustive enumeration.

03

Common Enterprise Patterns

Wildcard matching enables defense-in-depth strategies against unauthorized AI training data ingestion:

  • Query parameter stripping: Disallow: /*?* blocks all URLs containing query strings, preventing crawlers from accessing dynamically generated or filtered content
  • Session ID isolation: Disallow: /*;jsessionid=* prevents indexing of URLs with session tokens
  • Faceted navigation control: Disallow: /products/*/filter:* blocks infinite faceted navigation paths
  • API endpoint shielding: Disallow: /api/*/internal/* protects internal service endpoints from discovery
RFC 9309
Governing Standard
04

Limitations and Edge Cases

Wildcard matching in robots.txt has intentional constraints that differ from full regular expressions:

  • Wildcards cannot match across path segments unless explicitly placed to span a /
  • No support for character classes ([abc]), quantifiers (+, ?), or alternation (|)
  • The * matches the empty string, meaning Disallow: /dir/* also blocks /dir/ itself
  • Trailing wildcards are redundant: Disallow: /path* and Disallow: /path are functionally equivalent
  • Maximum pattern length is bounded by the 500 KiB total file size limit defined in RFC 9309
06

AI Crawler-Specific Strategies

Modern AI training crawlers require targeted wildcard rules to protect proprietary content while maintaining search engine visibility:

  • Bot-specific blocks: User-agent: GPTBot followed by Disallow: /proprietary-data/* targets only OpenAI's crawler
  • Training data exclusion: Disallow: /training-corpus/* prevents bulk data harvesting paths
  • API documentation shielding: Disallow: /docs/api/*/internal/* protects internal API specs from model training ingestion
  • Dynamic content protection: Disallow: /*?output=json* blocks machine-readable endpoints that could be scraped for structured training data
WILDCARD MATCHING IN ROBOTS.TXT

Frequently Asked Questions

Clear, concise answers to the most common technical questions about using the asterisk (*) character for pattern matching in the Robots Exclusion Protocol.

Wildcard matching in robots.txt is a pattern-matching mechanism that uses the * character to represent any sequence of zero or more valid characters in a URL path. This allows a single directive to apply to a broad range of URLs without listing each one individually. For example, the pattern /api/*/v2 would match /api/users/v2, /api/products/v2, and /api/admin/settings/v2. The * wildcard is not a formal part of the original RFC 9309 standard but is a widely supported extension implemented by major crawlers, including Googlebot and GPTBot. It provides a powerful way to manage crawl budgets and control access to dynamically generated or parameterized sections of a site. The wildcard can be placed at the beginning, middle, or end of a path segment to create flexible matching rules.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.