The new regex is more efficient, because it tries to match as long as
possible using repetitions of a character class, instead of repetitions
of an alternation, leading to fewer internal states.
$closing = preg_quote($closing);
if ($quotedEscapeSequence) {
- $quotesRegEx .= $opening.'(?>[^'.$closing.$quotedEscapeSequence.']|'.$quotedEscapeSequence.'.)*'.$closing;
+ $quotesRegEx .= $opening.'(?>[^'.$closing.$quotedEscapeSequence.']+|('.$quotedEscapeSequence.'.)+)*'.$closing;
}
else {
$quotesRegEx .= $opening.'(?>[^'.$closing.$quotedEscapeSequence.'])*'.$closing;