From 55eb38a008c2f98653fb3aedbc8c078968cf746b Mon Sep 17 00:00:00 2001 From: Tomek Date: Sun, 5 Jan 2025 12:46:45 +0100 Subject: [PATCH] Updated terminatorRegex in the parser --- src/EDI/Parser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(