diff --git a/src/EDI/Parser.php b/src/EDI/Parser.php index e1bec00..9166f7a 100644 --- a/src/EDI/Parser.php +++ b/src/EDI/Parser.php @@ -522,10 +522,10 @@ private function unwrap(string &$string): array $this->errors[] = 'This file contains some segments without terminators'; } - $terminatorRegex = '/(([^'.$this->symbRel.']'.$this->symbRel.'{2})+|[^'.$this->symbRel.'])'.$this->symbEnd.'|[\r\n]+/'; + $terminatorRegex = '/((?symbRel.')(?:'.$this->symbRel.$this->symbRel.')*)'.$this->symbEnd.'|[\r\n]+/'; if ($this->strict) { - $terminatorRegex = '/(([^'.$this->symbRel.']'.$this->symbRel.'{2})+|[^'.$this->symbRel.'])'.$this->symbEnd.'/'; + $terminatorRegex = '/((?symbRel.')(?:'.$this->symbRel.$this->symbRel.')*)'.$this->symbEnd.'/'; } $string = (string) \preg_replace(