C# regular expression to validate email
程序员文章站
2022-10-13 15:34:37
using System; using System.Text.RegularExpressions; namespace ConsoleApp375 { class Program { static void Main(string[] args) { RegularExpressionDemo(... ......
using system; using system.text.regularexpressions; namespace consoleapp375 { class program { static void main(string[] args) { regularexpressiondemo(); console.readline(); } static void regularexpressiondemo() { string emailpattern = @"^[\w!#$%&'*+\-/=?\^_`{|}~]+(\.[\w!#$%&'*+\-/=?\^_`{|}~]+)*@((([\-\w]+\.)+[a-za-z]{2,4})|(([0-9]{1,3}\.){3}[0-9]{1,3}))\z"; regex regex = new regex(emailpattern); string mymail = "aaa@163.com"; var match = regex.match(mymail); console.writeline(match.success); } } }
上一篇: 孕妇可以吃小龙虾吗后期,看了不要被吓到啊
下一篇: 听不听话?