标签:正则表达式 tom sel query 语句 names replace select enum
某语句如果不用正则表达式:
string[] names = { "Tom", "Dick", "Harry", "Mary", "Jay" };
IEnumerable<string> query = names.Select(n => n.Replace("a", "").Replace("e", "").Replace("i", "").Replace("o", "").Replace("u", ""))
用正则表达式可简化为:
IEnumerable<string> query =names.select(n => Regex.Replace(n, "[aeiou]", ""));
标签:正则表达式 tom sel query 语句 names replace select enum
原文地址:http://www.cnblogs.com/mol1995/p/7500664.html