ForHosting KIT · Text & AI

Glob to regex converter

Turn a wildcard pattern like *.js into the matching regular expression: you get ^[^/]*\.js$. Handy when a tool wants a regular expression and you think in wildcards. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Pattern
*.js
You get
Source
^[^/]*\.js$
Flags

Convert a shell-like glob pattern to a regular expression source. Search intent: glob to regex / wildcard to regex. No network calls, no random seeds, and no server state are required for a correct answer.

What changes when a glob becomes a regular expression

Glob patterns are the wildcards you type in a shell or a file filter: *.js for every JavaScript file, ? for a single character, [abc] for one character out of a set. Many tools, however, only accept regular expressions, where the same idea has to be written differently. This converter does the translation for you. For *.js it returns ^[^/]*\.js$: the star becomes a run of any characters except a slash, so it stays inside one folder level, and the dot is escaped so that it means a real dot instead of any character.

Double stars, anchoring and repeatable results

A double star, **, becomes .*, which also crosses slashes, so it can match paths several folders deep. Anchoring is optional: when it is on, the expression is wrapped in ^ and $ and has to match the whole text, not just a piece of it. The conversion runs entirely in your browser, makes no network calls and uses nothing random, so the same glob always produces the same expression, which matters when you document a rule or teach how wildcards work.

How it works

Convert a shell-like glob pattern to a regular expression source. Supports *, ?, character classes, and ** as .* ; optional anchoring. The implementation is pure JavaScript with no external services.

No network calls, no random seeds, and no server state are required for a correct answer. Failed jobs are not billed. Landings target the stated search intent with precise keywords.

Prefer explicit units and ranges over silent coercion of bad types. When a field is optional, defaults are documented in params and echoed in the

When to use it

Use this when your search intent matches the calculator name and you need a reproducible answer for teaching, finance ops, GIS, text tooling, or unit history work. Convert a shell-like glob pattern to a regular expression source. No network calls, no random seeds, and no server state are required for a correct answer.

Failed jobs are not billed. Landings target the stated search intent with precise keywords. Prefer explicit units and ranges over silent coercion of bad types.

When a field is optional, defaults are documented

Does it call the network?

No. All math and text transforms are local and deterministic.

Which wildcards does it understand?

The star, the question mark, character classes written in square brackets such as [abc], and the double star. Each one is translated into its regular expression equivalent, and the result can be anchored to the whole text or not.

Why does a single star become [^/]* and not .*?

Because in a glob a single star stays within one folder level. Writing it as any run of characters except a slash keeps *.js from matching a file in a subfolder; use the double star when you do want to cross folders.

What happens if I turn anchoring off?

The expression is no longer wrapped in ^ and $, so it can match part of a longer piece of text instead of having to match it from start to finish. Keep it on when the pattern must describe the whole name.

Will the same glob always give the same expression?

Yes. The conversion uses no random values and keeps nothing between uses, so a given glob with the same anchoring choice always produces exactly the same regular expression, which makes results easy to document and repeat.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/text/glob-to-regex

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/text/glob-to-regex \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pattern":"*.js"}'
{
  "pattern": "*.js"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "text.glob_to_regex",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract from

How it works

The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract from spreadsheets, CMS hooks, automation, or teaching demos.

Inputs, limits and rounding

Optional decimals use half-up once. No network calls, no random seeds, and no server state are required for a correct answer. Failed jobs are not billed. Landings target the stated search intent with precise keywords. Prefer explicit units and ranges over silent coercion of bad types. When Provide the required parameters as JSON numbers or strings as documented. Invalid types, missing required fields, or out-of-range values raise invalid_input with a clear message. Outputs echo key inputs so automation can log the full context of each call. The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract from spreadsheets, CMS hooks, automation, or teaching demos.

When to use it

The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract from spreadsheets, CMS hooks, automation, or teaching demos.

Quick check

Paste values in the free widget and compare with a spreadsheet.

Automation

Call the API with the same JSON contract from n8n, scripts, or CMS.

Teaching

Show the formula and pinned golden examples without proprietary software.

Is it free in the browser?

Yes. Tier A runs fully client-side with the same core as the API.

What happens on bad input?

The handler throws invalid_input; failed jobs are not billed.

Can I use it from the API?

Yes. Send the same JSON fields documented in params.

Who authors this?

Aspire (elon@forhosting.com), EN-only delivery; Nitro hydrates locales.

Read the full KIT documentation →