> For the complete documentation index, see [llms.txt](https://racoon-js.gitbook.io/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://racoon-js.gitbook.io/zh/jie-kou-shuo-ming/string/pattern.md).

# pattern

pattern(regExp)

## 作用

以正则表达式对字符串做模式检测。

## 参数

* `regExp`***(RegExp)*** 用于模式检测的正则表达式。

## 示例

```javascript
const schema = racoon.string().pattern(/$\d{4}-\d{2}-\d{2}^/);
schema.validate('2020-ab-cd'); // fail
schema.validate('2020-08-03'); // pass
```
