Kai*_*Kai 3 .net c# regex .net-2.0 c#-2.0
我正在尝试编写一个ac#search函数,它支持SQL中的"%",就像搜索中的运算符一样.例如,
"%m%"将匹配以下所有字符串.
"%m%e"将匹配类似"some"的字符串.
Rub*_*ias 5
static bool Like(string expression, string value) { return Regex.IsMatch(value, "^" + Regex.Escape(expression).Replace("%", @"[\s\S]*?") + "$", RegexOptions.IgnoreCase); }
归档时间:
14 年,11 月 前
查看次数:
165 次
最近记录: