escape chars for regex csharp

Code Example - escape chars for regex csharp

                
                        // 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) + ".*%%%~COMPRESS~PRE~0~%%%quot;);
    return regex.IsMatch(haystack);
}