What are best practices for handling multi-line text areas in PHP when using regular expressions?

When working with multi-line text areas in PHP and using regular expressions, it's important to use the "s" modifier to ensure that the dot metacharacter matches newline characters as well. This allows the regular expression to properly match across multiple lines in the text.

// Example of using the "s" modifier in a regular expression for multi-line text
$text = "Line 1\nLine 2\nLine 3";
$pattern = '/Line.*3/s';

if (preg_match($pattern, $text, $matches)) {
    echo "Match found: " . $matches[0];
} else {
    echo "No match found";
}