Botframework Pattern 使用常规简单的电子邮件正则表达式给我错误
Botframework Pattern is giving me errors with regular easy regex expressions for email
我尝试使用我的机器人发送电子邮件的这种模式,但它在 Skype 上发布时不起作用。它总是拒绝任何正常的有效电子邮件。
[Describe("email "), Prompt(QuestionWhatIsYour)]
[Pattern(@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")]
public string Email;
我也试过了
[Pattern(@"^[\w!#$%&'*+\-/=?\^_`{|}~]+(\.[\w!#$%&'*+\-/=?\^_`{|}~]+)*((([\-\w]+\.)+[a-zA-Z]{2,4})|(([0-9]{1,3}\.){3}[0-9]{1,3}))$")]
And
^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$
我缺少什么才能使模式正常工作?
如果我使用本地主机 API 和 BotFramework Channel Emulator 尝试机器人,所有表达式都运行良好
发生这种情况是因为来自 Skype 的电子邮件是 link:
{
"type": "message",
"id": "1518201259505",
"timestamp": "2018-02-09T18:34:19.515Z",
"localTimestamp": "2018-02-10T01:34:19.515+07:00",
"serviceUrl": "https://smba.trafficmanager.net/apis/",
"channelId": "skype",
"from": {
"id": "29:1e6pgQhUZAJSct6xsOxTh1160QpUF1CXkZXqD4VRDx9A",
"name": "User"
},
"conversation": {
"id": "29:1e6pgQhUZAJSct6xsOxTh1160QpUF1CXkZXqD4VRDx9A"
},
"recipient": {
"id": "28:62516114-227c-436c-8e55-e7dcf50e7474",
"name": "Bot"
},
"membersAdded": [],
"membersRemoved": [],
"text": "<a href=\"mailto:mail@ukr.net\">mail@ukr.net</a>",
"attachments": [],
"entities": [
{
"type": "clientInfo",
"locale": "en-US",
"country": "US",
"platform": "Windows"
}
],
"channelData": {
"text": "<a href=\"mailto:mail@ukr.net\">mail@ukr.net</a>"
}
}
我尝试使用我的机器人发送电子邮件的这种模式,但它在 Skype 上发布时不起作用。它总是拒绝任何正常的有效电子邮件。
[Describe("email "), Prompt(QuestionWhatIsYour)]
[Pattern(@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")]
public string Email;
我也试过了
[Pattern(@"^[\w!#$%&'*+\-/=?\^_`{|}~]+(\.[\w!#$%&'*+\-/=?\^_`{|}~]+)*((([\-\w]+\.)+[a-zA-Z]{2,4})|(([0-9]{1,3}\.){3}[0-9]{1,3}))$")]
And
^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$
我缺少什么才能使模式正常工作?
如果我使用本地主机 API 和 BotFramework Channel Emulator 尝试机器人,所有表达式都运行良好
发生这种情况是因为来自 Skype 的电子邮件是 link:
{
"type": "message",
"id": "1518201259505",
"timestamp": "2018-02-09T18:34:19.515Z",
"localTimestamp": "2018-02-10T01:34:19.515+07:00",
"serviceUrl": "https://smba.trafficmanager.net/apis/",
"channelId": "skype",
"from": {
"id": "29:1e6pgQhUZAJSct6xsOxTh1160QpUF1CXkZXqD4VRDx9A",
"name": "User"
},
"conversation": {
"id": "29:1e6pgQhUZAJSct6xsOxTh1160QpUF1CXkZXqD4VRDx9A"
},
"recipient": {
"id": "28:62516114-227c-436c-8e55-e7dcf50e7474",
"name": "Bot"
},
"membersAdded": [],
"membersRemoved": [],
"text": "<a href=\"mailto:mail@ukr.net\">mail@ukr.net</a>",
"attachments": [],
"entities": [
{
"type": "clientInfo",
"locale": "en-US",
"country": "US",
"platform": "Windows"
}
],
"channelData": {
"text": "<a href=\"mailto:mail@ukr.net\">mail@ukr.net</a>"
}
}