Check quotes in a file
<?php $file = fopen("data.txt", "r") or die("Cannot open file!\n"); $lineNbr = 0; while ($line = fgets($file, 1024)) { $lineNbr++; if (preg_match("/^[^\"]*\"([^\"]*|([^\"]*\"[^\"]*\"[^\"]*)*)$/", $line)) { echo "Found match at line " . $lineNbr . ": " . $line; } } fclose($file); ?>