What is any character (including new line) pattern in regex?

c#, regex

Solution

Using #C, you can use the RegexOptions.Singleline compiler flag.

Use single-line mode, where (`.`) matches every character (instead of every character except `\n`)

And instead of the RegexOptions.Singleline compiler flag, you can get the same effect by placing an inline modifier at the very beginning of your regular expression.

Regex.Match(input, @"(?s)foo.*bar");

Problem

Does regex have a pattern that match any characters including new line in regex? The `dot` pattern match any characters but isn't including new line, (currently, I'm using `[^~]` because the `~` character is rarely use). Edit: I'm using `regex` with `C#` language.

Original source

Related problems