> For the complete documentation index, see [llms.txt](https://wskdsgcf.gitbook.io/mastering-go-zh-cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wskdsgcf.gitbook.io/mastering-go-zh-cn/04.0/04.4.md).

# 04.4 正则表达式与模式匹配

模式匹配在Go中占有重要的地位，是能够根据正则表达式查询出特定的字符集的技术。模式匹配成功后你就可以提取出你想要的字符串，并对其进行替换、删除等进一步操作。

Go标准库中已经帮你设计好了用于正则表达式的包-`regexp`，我们将会在下面深入讨论。

> 当你在代码中使用正则表达式时，定义符合条件的正则表达式是重中之重。
