What is the regular expression that matches all characters (.*
) also with a carriage return?
Regular expression that matches all characters (.*) with also carriage return?
It is
(?s).*
See demo
The (?s)
flag makes .
match any character, even a newline.
The flag can be set after the second delimiter, too:
$re = "/.*/s";
See another demo