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
:From MSDN, RegexOptions Enumeration:
Include the RegexOptions.SingleLine which means that
.
matches everything, including\n
See http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regexoptions.aspx for more details.
Use Singleline instead of Multiline:
BTW, RegexBuddy is your invaluable friend (No, I'm not connected whatsoever to the author, except for being a happy user).