Convert a regex to a glob pattern

Convert the safe, portable parts of a regular expression into a filename glob.

freeworks offlinenothing uploaded
ToolRegex to Glob
Input
Output

How it works

Regex wildcards map to glob stars and question marks where semantics align; escaped literals remain literal. Alternation, lookarounds, and other non-glob constructs are flagged instead of silently broadened.

  • Glob syntax is simpler than regex.
  • Conservative conversion avoids matching more files than intended.

Worked example

Convert a regex to a glob pattern
Convert a regex matching JavaScript files to a glob pattern
Input
											^.*\.js$
										
Output
												**.js
											

When to use this

Gitignore rules, build includes, and file-picker filters convert patterns.

Edge cases

  • Alternation such as (js|ts) has no single portable glob.
  • Regex anchors have no filename wildcard equivalent.
  • Whether * crosses directories depends on the glob matcher.