diff --git a/src/PhpSpreadsheet/Reader/Csv.php b/src/PhpSpreadsheet/Reader/Csv.php index 25f244c1..45a651c1 100644 --- a/src/PhpSpreadsheet/Reader/Csv.php +++ b/src/PhpSpreadsheet/Reader/Csv.php @@ -155,7 +155,7 @@ class Csv extends BaseReader return; } - $potentialDelimiters = [',', ';', "\t", '|', ':', ' ']; + $potentialDelimiters = [',', ';', "\t", '|', ':', ' ', '~']; $counts = []; foreach ($potentialDelimiters as $delimiter) { $counts[$delimiter] = []; @@ -258,11 +258,8 @@ class Csv extends BaseReader $line = preg_replace('/(' . $enclosure . '.*' . $enclosure . ')/U', '', $line); // See if we have any enclosures left in the line - $matches = []; - preg_match('/(' . $enclosure . ')/', $line, $matches); - - // if we still have an enclosure then we need to read the next line aswell - if (count($matches) > 0) { + // if we still have an enclosure then we need to read the next line as well + if (preg_match('/(' . $enclosure . ')/', $line) > 0) { $line = $this->getNextLine($line); }