I am trying to add line breaks using this pattern---- $pattern = "/^.$pattern.\$/m"; but I don't seem to get the results I want. Any help would be appreciated. Thanks.
Use s modifier.
$pattern = "/^.$pattern.\$/s";
http://php.net/manual/en/reference.pcre.pattern.modifiers.php