Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Regex(@"@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,4}$", RegexOptions.Compiled);
使用上述内容,我只想传递@gmail.com、@xyz.edu、@co.uk 等值...但我发现像 abc@gmail.com(有效的电子邮件 ID)这样的值也可以通过。
我应该修改什么?
^在前面放一个@。
^
@
顺便说一句,{2,4}到底为什么。.travel也是一个有效的顶级域。
{2,4}
.travel
域不能以-字符开头。
-
^(?:[a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,6}$
Uri uri = new Uri("http://www.cnn.com/some_link/document.htm"); string url = uri.Host.ToString();