What are some common pitfalls when using preg_match_all to parse multi-line strings in PHP?

When using preg_match_all to parse multi-line strings in PHP, a common pitfall is that the dot (.) metacharacter does not match newline characters by default. To solve this issue, you can use the "s" modifier in your regular expression pattern to make the dot match all characters, including newlines.

// Example code snippet to parse multi-line strings using preg_match_all with the "s" modifier
$multiLineString = "Line 1\nLine 2\nLine 3\n";
$pattern = '/Line \d/s'; // Using the "s" modifier to match newlines
preg_match_all($pattern, $multiLineString, $matches);
print_r($matches[0]);