将JavaScript Regex转换为C#
如何将以下Regex语句转换为C#?
Match match = Regex.Match(line.Trim(), @"/^[A-Za-z-.]+([,;]\s?[A-Za-z-.]+)*$/", RegexOptions.IgnoreCase); if (match.Success) //do something
Match方法中提到的模式是我从javascript方法中选择的模式。 它基本上与Jane,Doe
Jane;Doe
Jane, Doe; Jack, Doe
等名称相匹配Jane, Doe; Jack, Doe
Jane, Doe; Jack, Doe
请指教。
删除/
在字符串的开头和结尾。