Glob to Regex

Turn * and ? globs into a regex; optional anchors and flags.

Builds a regex with * as .* and ? as one character. Anchors with ^ and $ by default. Optional flags (gimsuy). Unlike Regex Escape this expands wildcards instead of escaping them. Unlike Regex Tester this does not run a match. Empty glob fails. Character classes in the glob are treated as literals.

What Glob to Regex does

Builds a regex with * as .* and ? as one character. Anchors with ^ and $ by default. Optional flags (gimsuy). Unlike Regex Escape this expands wildcards instead of escaping them. Unlike Regex Tester this does not run a match. Empty glob fails. Character classes in the glob are treated as literals.

Glob to Regex sits in the Developer group on purpose. It is not Regex Escape (Regex escape with counts.) and not Regex Tester (Test or replace with a JavaScript regex locally.). Choose this page when you need Turn * and ? globs into a regex; optional anchors and flags. If you stretch Glob to Regex into a neighbor’s job, the result will look wrong even though the site chrome looks the same.

How to use Glob to Regex

  1. Keep this tab on Glob to Regex (/developer/glob-to-regex). Pasting into the wrong Developer tool (for example Regex Escape) changes the job.
  2. Paste or type the input Glob to Regex expects. Path hint: developer · glob to regex. Turn * and ? globs into a regex; optional anchors and flags.
  3. Apply the Glob to Regex action only. Regex Tester is a different transform (Test or replace with a JavaScript regex locally.). Builds a regex with * as .* and ? as one character. Anchors with ^ and $ by default. Optional flags (gimsuy). Unlike Regex Escape this expands wildcards instead of escaping them. Unlike Regex Tester this does not run a match. Empty glob fails. Character classes in the glob are treated as literals.
  4. Copy the output of Glob to Regex if you need it elsewhere. Size/complexity still follows: Empty glob fails. Classes in the glob are literals. Flags limited to gimsuy.
  5. If the text job is actually Regex escape with counts., leave Glob to Regex and open Regex Escape.

When not to use Glob to Regex

Skip Glob to Regex when a neighbor tool matches better — start with Regex Escape or Regex Tester — or when the description already warns the job will fail. In the tool’s own words: Builds a regex with * as .* and ? as one character. Anchors with ^ and $ by default. Optional flags (gimsuy). Unlike Regex Escape this expands wildcards instead of escaping them. Unlike Regex Tester this does not run a match. Empty glob fails. Character classes in the glob are treated as literals.

Questions about Glob to Regex

What does Glob to Regex do that other Developer pages on this site do not?
Builds a regex with * as .* and ? as one character. Anchors with ^ and $ by default. Optional flags (gimsuy). Unlike Regex Escape this expands wildcards instead of escaping them. Unlike Regex Tester this does not run a match. Empty glob fails. Character classes in the glob are treated as literals. Short version: Turn * and ? globs into a regex; optional anchors and flags.
Does Glob to Regex upload my file or text to Tool-You servers?
No. Glob to Regex runs in this browser tab. Files stay on the device. Limit note: Empty glob fails. Classes in the glob are literals. Flags limited to gimsuy.
Should I use Regex Escape instead of Glob to Regex?
Use Glob to Regex when you need Turn * and ? globs into a regex; optional anchors and flags. Use Regex Escape when you need Regex escape with counts. They share a category (Developer) but not the same job.
What are the limits of Glob to Regex?
Empty glob fails. Classes in the glob are literals. Flags limited to gimsuy. Also: Builds a regex with * as .* and ? as one character. Anchors with ^ and $ by default. Optional flags (gimsuy). Unlike Regex Escape this expands wildcards instead of escaping them. Unlike Regex Tester this does not run a match. Empty glob fails. Character classes in the glob are treated as literals.