flclash.st
English
简体中文繁體中文EnglishРусскийفارسی

HomeRecipesRegion groups

Region groups

With hundreds of nodes, url-test groups per region are the easiest. Use include-all with a filter regex to pick nodes by name, exclude-filter to drop info nodes like "traffic left", and let rules point different services at different regions.

Ingredients

  • A configuration that already works (single subscription or merged)
  • Node names that carry a region marker, such as "Hong Kong", "HK" or "🇯🇵"

The idea

mihomo groups can pick nodes by name with a filter regex. With include-all: true, the group takes every node whose name matches from all providers, and url-test then picks the lowest delay automatically.

A pin on a map: each group pins down one region
A pin on a map: each group pins down one region Arlo James Barnes, Public domain

Steps

Groups by region
proxy-groups:
  - name: Hong Kong
    type: url-test
    include-all: true
    filter: "(?i)港|\\bHK\\b|Hong ?Kong"
    exclude-filter: "剩余|到期|官网"
    url: https://www.gstatic.com/generate_204
    interval: 300
  - name: Japan
    type: url-test
    include-all: true
    filter: "(?i)日本|\\bJP\\b|Japan|Tokyo"
    url: https://www.gstatic.com/generate_204
    interval: 300
  1. Copy a few node names and try the regex in the workshop's node name filter to make sure it catches what it should and nothing else.
  2. Paste the generated groups under proxy-groups in the configuration.
  3. Refer to the groups in rules, for example send a streaming service to "Japan".

Regex pitfalls

PatternProblemUse instead
HKAlso catches names that happen to contain the letters, like "SHKL-01"\bHK\b
USMatches "Russia"\bUS\b
No (?i)Misses a lower-case "japan"Add (?i) at the start

Check

On the Proxies page, make sure each region group holds the right nodes and run a speed test. An empty group means the regex matched nothing; go back to the filter tool and adjust it.

Why two backslashes in the YAML?

Inside a double-quoted string, \\b is what gives \b in the regex. With single quotes, one is enough.

Do new nodes join groups automatically?

Yes. After a subscription update, new nodes whose names match go into the right groups.

Read onService checks

Read alongside

This page covers: FlClash region groups, Clash filter regex, auto-select Hong Kong nodes