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.
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With