Wildcard to Regex

Convert wildcard patterns with * and ? to regular expressions.

Convert shell-style wildcard patterns into regular expressions: * matches any characters and ? matches one character, so *.log becomes ^.*\.log$. Every other character, including brackets, is escaped so it matches literally. Choose whether to match the whole string, and output either the pattern or a /pattern/ literal with an optional case-insensitive flag.

Need the reverse? Regex to Wildcard

Common use cases

  • Turn a file glob into a regex for code or a log filter
  • Convert user-friendly search patterns into regex
  • Write filter rules for tools that only accept regex

How to use

  1. Type wildcard patterns, one per line.
  2. Choose anchoring and output format.
  3. Copy the regex.

FAQ

Does it support ** for folders?

No. ** is a globbing extension for nested folders; here * matches any characters, including slashes.

Can I go back?

The regex to wildcard tool converts simple regular expressions back into wildcards.