How can I get global Regex in one string, and not in collection
Regex r = new Regex(".+");
Match match = r.Match("aaaa \r\n bbbb");
string result=match.Value;
I get: result="aaaa " and I want: result="aaaa \r\n bbbb"
I know that I can get that in a collection, but I need get that in Match datatype rather.
.doesn’t match linebreaks unless you make it to.You can use
(?s)for that, like:new Regex("(?s).+")Or the
Singlelineoption, like:new Regex(".+", RegexOptions.Singleline)