<?php

$myfile = 'a,2014-10-05 19:00:40,

b,2014-10-05 19:00:31,';

$name = 'a';

if(preg_match("/$name\,(.*),/", $myfile, $matches))
{
   //$results = preg_replace("/$name.*\,/", $txt, $myfile);
}

echo $matches[1];