I have a regex that I checked in three separate sources, successfully matching the right text.
But, when I use regex in my code. This does not give a match. I used another regex with this code, and they led to the desired matches. I am at a loss ...
string SampleText = "starttexthere\r\nothertexthereendtexthere"; string RegexPattern = "(?<=starttexthere)(.*?)(?=endtexthere)"; Regex FindRegex = new Regex(@RegexPattern); Match m = FindRegex.Match(SampleText);
I do not know if the problem is my regular expression or my code.
, \r\n, , . , option . \n ( )
\r\n
.
\n
Regex FindRegex = new Regex(@RegexPattern, RegexOptions.Multiline | RegexOptions.Singleline);
RegexOptions.Multiline.
RegexOptions.Multiline
, , (\r\ \n).
\r\
, : (?<=starttexthere)[\w\r\n]+(?=endtexthere), .
(?<=starttexthere)[\w\r\n]+(?=endtexthere)
-: http://ideone.com/ZXgKar