工作java代码:
@Test
public void test1() {
String regex = "^((19|20)\\d\\d)(0?[1-9]|1[012])(0?[1-9]|[12][0-9]|3[01])$";
Assert.assertTrue("Date: matched.", Pattern.matches(regex, "19881231")); -- true
}
properties:
lineofValue:
type: string
pattern: ^AB|CD$
description: mandatory
date:
type: string
pattern: ^((19|20)\\d\\d)(0?[1-9]|1[012])(0?[1-9]|[12][0-9]|3[01])$
description: mandatory
样本要求:
{
"lineofValue":"AB"
"date":"19881231"
}
{
"code": "400",
"status": 400,
"message": "Validation Failed: ECMA 262 regex \"^((19|20)\\\\d\\\\d)(0?[1-9]|1[012])(0?[1-9]|[12][0-9]|3[01])$\" does not match input string \"19881231\""
}