<?php
$string = '$error = "An error page was displayed to the Web Services user.\nDetails: The Status you have chosen is invalid.\n\nStack Trace: Stack trace:.........";';
$pat = "/.+Details: (.+) \\n\\nStack.+/m";
preg_match($pat,$string,$matches);
var_dump($matches);