Add some backtracking control

Not terribly necessary here, because inputs are short, but it's a
good practice. I wish there was a way to just disable backtracking for
the entire regex since this kind of pattern doesn't need any of it.
This commit is contained in:
Juerd Waalboer 2023-12-26 04:53:10 +01:00
parent 0d3866a881
commit bdd92748ab

View file

@ -36,10 +36,10 @@ sub split_input($input) {
while (
$input =~ m[
\G \s*
(?| (') ( (?: \\. | [^\\'] )* ) ' (?=\s|;|$)
| (") ( (?: \\. | [^\\"] )* ) " (?=\s|;|$)
| () ( (?: \\. | [^\\;'"\s] )+ ) (?=\s|;|$)
\G \s*+
(?| (') ( (?: \\. | [^\\'] )*+ ) ' (?=\s|;|$)
| (") ( (?: \\. | [^\\"] )*+ ) " (?=\s|;|$)
| () ( (?: \\. | [^\\;'"\s] )++ ) (?=\s|;|$)
| () (;)
)
]xg