Like most other special characters in regular expressions, when a .appears with a character class, it represents an alphabetic character .. If you want to combine all the characters, the general method is to use something like this:
[\s\S]*
Or, alternatively, you can use RegexOptions.Singlelineto indicate that it .should match all characters and just use:
.*
For example:
var input = "foo\r\nbar";
var match = Regex.Match(input, ".*", RegexOptions.Singleline);
Assert.AreEqual(input, match.Value);
source
share