> For the complete documentation index, see [llms.txt](https://chaoses-ib.gitbook.io/directory-opus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chaoses-ib.gitbook.io/directory-opus/guan-fang-shou-ce/readme.zh-10/readme.zh-4/match.zh.md).

# Match

\<evalcmd> 匹配 && 布尔 && 如果 *字符串* 匹配 *模式*，则为 **True**。 && 字符串 && 字符串 && 要比较的字符串。 && 模式 && 字符串 && 要比较的模式。 && \[标志] && 字符串 && 可选标志为：

|       |                         |
| ----- | ----------------------- |
| **c** | 操作期间考虑大小写               |
| **x** | 根据多个文件扩展名进行简单匹配         |
| **d** | 仅支持 DOS 通配符             |
| **r** | 使用正则表达式                 |
| **h** | 轻松处理文件路径（\\\ 和 / 被视为相同） |
| **a** | "任意单词" 模式               |
| **i** | 忽略变音符号                  |
| **f** | 支持文件类型组                 |
| **p** | 部分匹配                    |

\</evalcmd>

如果输入的 *字符串* 匹配指定的 Wildcard *模式*，则返回 **True**。默认情况下，这会使用 [标准模式匹配](/directory-opus/guan-fang-shou-ce/readme.zh-10/readme.zh/pattern_matching_syntax.zh.md) - 指定 **r** 标志以改为使用 [正则表达式](/directory-opus/guan-fang-shou-ce/readme.zh-10/readme.zh/regular_expression_syntax.zh.md)。

//<Example://>

```
if (Match(name, "*.txt")) { ... } // 文件是否有 .txt 扩展名？
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://chaoses-ib.gitbook.io/directory-opus/guan-fang-shou-ce/readme.zh-10/readme.zh-4/match.zh.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
