allow for spaces after "---"
<?php
$contents = preg_split('/\r?\n?---(|\s+)\r?\n/m', "--- \nhello:1\nworld:2\nok:1\nok:2\n---\nsaac");
if (sizeof($contents) < 3) {
throw new \Exception("Failed to parse proposal, can't find YAML description surrounded by '---' lines");
} else {
echo "\nIts ok";
}
?>
(|\s+) = nothing OR space(s) "--- " "---" "--- " = ok