preg_match不能在php中使用文本文件

Looping through a text file in php, I'm using preg_match to detect if the line contains "default" and put a comma after that word instead of a space, but it's not working:

   $FSCS = "";

 //Read the txt file
if(($handle = fopen("FSCS.txt", "r")) != false)
{
//Loop through each line
  while(($data = fgetcsv($handle, 1000, ",")) != false)
  {
    if(preg_match("/default/", $data[0])) $FSCS .= str_replace("default ", "default,", trim($data[0]))."
";        

    else $FSCS .= trim($data[0]).",";
  }
}

Every line is processed by the "else" statement

$FSCS = "";

//Read the txt file
if (($handle = fopen("FSCS.txt", "r")) != false)
{
    //Loop through each line
    // Use fgets to read the whole line and use fgetcsv to read and parse a CSV file
    while(($data = fgets($handle, 1000)) != false)
    {
        // The \s matches whitespace
        if (preg_match("/default\s/", $data))
        {
            $FSCS .= preg_replace("/default\s/", "default,", $data) . "
";        
        }
        else
        {
            $FSCS .= $data . "
";
        }
    }
}