What are common pitfalls when using regular expressions in PHP, specifically when dealing with multiline text?

When dealing with multiline text in PHP regular expressions, a common pitfall is forgetting to use the `s` modifier to allow the dot (`.`) to match newline characters. This can lead to unexpected results when trying to match patterns across multiple lines. To solve this issue, simply include the `s` modifier at the end of your regex pattern to ensure it works correctly with multiline text.

$text = "Line 1\nLine 2\nLine 3";
$pattern = '/Line.*3/s'; // Include the 's' modifier to match newline characters
if (preg_match($pattern, $text, $matches)) {
    echo "Match found: " . $matches[0];
} else {
    echo "No match found";
}