Match Any Character
.matches any character except line breaks.matches any character with api option
cs
_ = new Regex(@".", RegexOptions.Singleline);
// or
_ = new Regex(@"(?s).");1
2
3
2
3
[\s\S]and[\w\W]and[\d\D]match any character
TIP
Use . only when you really want to allow any character. Use a character class or negated character class in any other situation.
Mode modifier
Use (?s)/(?-s) to enable/disable singleline mode in regex literal