📜  正则表达式 c# 代码示例的转义字符

📅  最后修改于: 2022-03-11 14:49:05.731000             🧑  作者: Mango

代码示例1
// Don't actually do this to check containment... it's just a little example.
public bool RegexContains(string haystack, string needle)
{
    Regex regex = new Regex("^.*" + Regex.Escape(needle) + ".*$");
    return regex.IsMatch(haystack);
}