Skip to content

Commit 4c47f96

Browse files
committed
simplify
1 parent 29fd8f3 commit 4c47f96

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/Type/Regex/RegexGroupParser.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,9 @@ public function parseGroups(string $regex): ?array
7272
}
7373
}
7474

75-
// The regex engine ignores everything after the (?# until the first closing parenthesis
76-
$regex = preg_replace('/\(\?#[^)]*\)/', '', $regex) ?? '';
77-
7875
if (str_contains($modifiers, 'x')) {
7976
// in freespacing mode the # character starts a comment and runs until the end of the line
80-
$regex = preg_replace('/#.*/', '', $regex) ?? '';
77+
$regex = preg_replace('/[^?]#.*/', '', $regex) ?? '';
8178
}
8279

8380
$rawRegex = $this->regexExpressionHelper->removeDelimitersAndModifiers($regex);

0 commit comments

Comments
 (0)