Here is my regex: Regex r = new Regex("start(.*?)end", RegexOptions.Multiline);
That means I want to get the stuff between "start"
and "end"
. But the problem is that between start and end is a new line or \n
and the regex doesn't return anything.
So how do I make regex find \n
?
The name of the Multiline
option is misleading, as is the one of the correct option - Singleline
:
Regex r = new Regex("start(.*?)end", RegexOptions.Singleline);
From MSDN, RegexOptions Enumeration:
Singleline - Specifies single-line mode. Changes the meaning of the dot (.) so it matches every character (instead of every character except \n).
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