# Reverse-Skill `routing.json` Match Modes: Exact, Regex, and Fuzzy Keyword Routing Explained

> Explore exact, regex, and fuzzy keyword matching modes in reverse-skill's routing.json. Optimize your routing with precise pattern matching and typo tolerance.

- Repository: [ZhaoXu/reverse-skill](https://github.com/zhaoxuya520/reverse-skill)
- Tags: deep-dive
- Published: 2026-08-25

---

**Reverse-skill supports three match modes in [`routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.json): `exact` for literal matching, `regex` for pattern-based matching, and `fuzzy` for tolerance of typos and variations.**

The `reverse-skill` repository by zhaoxuya520 implements a flexible routing system that directs user requests to appropriate reverse-engineering skills based on keyword matching. Located at [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json), this configuration file defines how incoming commands are interpreted and dispatched. Understanding the available **match modes for keywords in `reverse-skill`'s [`routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.json)** is essential for customizing routing behavior to balance precision with flexibility.

## Exact Match Mode

The **exact** mode (`"mode": "exact"`) requires the user input to match the keyword literally, ignoring case differences but otherwise demanding character-for-character alignment.

Use this mode for short, unambiguous commands where precision matters. Common examples include `"ping"`, `"whoami"`, or `"ls"` when you want to avoid accidental matches.

```json
{
  "keyword": "ls",
  "mode": "exact",
  "skill": "skills/ida-reverse/SKILL.md"
}

```

```bash

# User input

$ reverse-skill "ls"

# Router finds the entry with "mode": "exact" and dispatches the corresponding skill.

```

Any deviation—extra characters, missing letters, or trailing spaces—will cause the match to fail.

## Regex Match Mode

The **regex** mode (`"mode": "regex"`) interprets the keyword as a JavaScript-compatible regular expression, enabling sophisticated pattern matching for complex command variations.

This mode shines when users might append arguments or use syntactic variations. You can capture groups, specify anchors, and apply quantifiers.

```json
{
  "keyword": "^ls\\s+.*$",
  "mode": "regex",
  "skill": "skills/ida-reverse/SKILL.md"
}

```

```bash

# User input

$ reverse-skill "ls -la /etc"

# The regex matches and the skill is executed.

```

Note that backslashes must be escaped in JSON, so `\\s` represents the whitespace character class.

## Fuzzy Match Mode

The **fuzzy** mode (`"mode": "fuzzy"`) employs approximate string matching—typically Levenshtein distance calculations—to recognize keywords despite minor spelling errors, transpositions, or extra words.

This mode suits natural-language queries where rigid matching would frustrate users. The router tolerates substitutions, deletions, and insertions up to a threshold.

```json
{
  "keyword": "list files",
  "mode": "fuzzy",
  "skill": "skills/ida-reverse/SKILL.md"
}

```

```bash

# User input

$ reverse-skill "lst fiels"

# The fuzzy matcher still resolves the request to the correct skill.

```

The fuzzy algorithm compares phonetic and orthographic similarity, making it robust against common typing mistakes.

## Choosing the Right Match Mode

| Mode | Precision | Flexibility | Best For |
|------|-----------|-------------|----------|
| **Exact** | High | None | System commands, reserved words |
| **Regex** | Configurable | Moderate | Parameterized commands, structured input |
| **Fuzzy** | Lower | High | Natural language, user-facing interfaces |

Mix modes within the same [`routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.json) file to handle different command categories appropriately. Place more specific rules (exact, then regex) before fuzzy entries to ensure precise matches take precedence.

## Source Files and Validation

The routing implementation relies on several tracked files in `zhaoxuya520/reverse-skill`:

- **[`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json)** — Central router definition containing all `mode` attributes for keyword entries
- **[`skills/scripts/test-routing.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/scripts/test-routing.sh)** — Bash validation script ensuring all three modes behave correctly under test conditions
- **`skills/scripts/verify-routing-coherence.ps1`** — PowerShell consistency checker that validates JSON structure against generated documentation

According to the `reverse-skill` source code, these scripts enforce that every routing entry specifies a valid `mode` value and that keyword patterns compile correctly for regex entries.

## Summary

- **Exact mode** demands literal, case-insensitive keyword matches for unambiguous commands
- **Regex mode** enables pattern-based matching with full regular expression support
- **Fuzzy mode** tolerates spelling variations and typos through approximate string matching
- All modes are configured per-entry in [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json) using the `mode` field
- Validation scripts at [`skills/scripts/test-routing.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/scripts/test-routing.sh) and `skills/scripts/verify-routing-coherence.ps1` ensure routing integrity

## Frequently Asked Questions

### What happens if multiple match modes could apply to the same input?

The router processes entries in [`routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.json) order, selecting the first match found. Place exact matches first, followed by regex patterns, then fuzzy entries to ensure predictable routing behavior.

### Does fuzzy mode have configurable sensitivity?

The source implementation uses a default Levenshtein distance threshold. Advanced users may modify the matching logic in the core router, but standard configuration through [`routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.json) does not expose distance parameters directly.

### Are regex patterns in routing.json case-sensitive?

By default, regex mode applies patterns as specified without automatic case folding. Include the `(?i)` inline flag or explicit character classes in your pattern to enable case-insensitive matching where needed.

### Can I combine match modes for a single keyword?

Each routing entry accepts exactly one `mode` value. To achieve combined behavior, create multiple entries with the same `skill` target but different modes and keywords, ordered by specificity.