// パスの形式 : sample/{groupId}(/{userId})
const pathDifinition = /^sample\/(?<groupId>[a-zA-Z0-9-_]+)(\/(?<userId>[a-zA-Z0-9-_]+)){0,1}$/
// 解析
// event.pathParameters.proxy (例: sample/group-012/user-545)
const pathParams = event.pathParameters.proxy.match(pathDifinition).groups;
console.log(pathParams.groupId); // group-0912 console.log(pathParams.userId); // user-545
/^([^\x00-\x7f]|[a-zA-Z0-9-_@])+$/
/^(apple|orange|strawberry)$/
/^[0-9][0-9-]+$/