I am stuck in an regex as well. Below RegEx works at .Net and React JS but not working at API Gateway JSON schema validate assertion Pattern value. Need to sort it out please.
RegEx: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
Schema sample is below for reference:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"transactionId": {
"type": "string"
},
"mail": {
"type": "string",
"pattern": "^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$"
}
}
Release : 10.1
escaping of certain chars requires \\
i.e.
https://json-schema.org/understanding-json-schema/reference/regular_expressions.html#example
This in my assertion works fine you can test it too.
{
"type": "object",
"properties": {
"progBinaryName": {
"type": "string",
"pattern": "^(\\([0-9]{3}\\))?[0-9]{3}-[0-9]{4}$"
}
}
}