pattern

pattern(regExp)

作用

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

参数

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

示例

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

最后更新于