pattern(regExp)
以正则表达式对字符串做模式检测。
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
最后更新于4年前
这有帮助吗?