Skip to content

Commit 55eb38a

Browse files
author
Tomek
committed
Updated terminatorRegex in the parser
1 parent 0832384 commit 55eb38a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/EDI/Parser.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -522,10 +522,10 @@ private function unwrap(string &$string): array
522522
$this->errors[] = 'This file contains some segments without terminators';
523523
}
524524

525-
$terminatorRegex = '/(([^'.$this->symbRel.']'.$this->symbRel.'{2})+|[^'.$this->symbRel.'])'.$this->symbEnd.'|[\r\n]+/';
525+
$terminatorRegex = '/((?<!'.$this->symbRel.')(?:'.$this->symbRel.$this->symbRel.')*)'.$this->symbEnd.'|[\r\n]+/';
526526

527527
if ($this->strict) {
528-
$terminatorRegex = '/(([^'.$this->symbRel.']'.$this->symbRel.'{2})+|[^'.$this->symbRel.'])'.$this->symbEnd.'/';
528+
$terminatorRegex = '/((?<!'.$this->symbRel.')(?:'.$this->symbRel.$this->symbRel.')*)'.$this->symbEnd.'/';
529529
}
530530

531531
$string = (string) \preg_replace(

0 commit comments

Comments
 (0)