What best practices should be followed when extracting text between specific markers in a multiline string using regular expressions in PHP?

When extracting text between specific markers in a multiline string using regular expressions in PHP, it is important to use the `s` modifier to make the dot (`.`) match newline characters as well. Additionally, using the `preg_match` function with the appropriate regex pattern can help extract the desired text efficiently.

<?php

// Multiline string with markers
$multilineString = "Lorem ipsum dolor sit amet,
<!-- START -->
consectetur adipiscing elit.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
<!-- END -->
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";

// Extract text between markers
preg_match('/<!-- START -->(.*?)<!-- END -->/s', $multilineString, $matches);
$extractedText = $matches[1];

echo $extractedText;

?>