What is the equivalent of PHP's preg_quote?
This is as far as I have gotten for creating a method that extracts text from a string:
public static string f_get_string_between(string text, string start, string end)
{
//both these attempts below throw an unrecognized escape sequence error
//start = "\Q"+start+"\E";
//end = "\Q"+end+"\E";
Regex regex = new Regex(start + "(.*?)" + end);
var v = regex.Match(text);
text = v.Groups[1].ToString();
return text;
}
Regex.Escape
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With