Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 16, 2024
1 parent 29fd8f3 commit 4c47f96
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/Type/Regex/RegexGroupParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,9 @@ public function parseGroups(string $regex): ?array
}
}

// The regex engine ignores everything after the (?# until the first closing parenthesis
$regex = preg_replace('/\(\?#[^)]*\)/', '', $regex) ?? '';

if (str_contains($modifiers, 'x')) {
// in freespacing mode the # character starts a comment and runs until the end of the line
$regex = preg_replace('/#.*/', '', $regex) ?? '';
$regex = preg_replace('/[^?]#.*/', '', $regex) ?? '';
}

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

0 comments on commit 4c47f96

Please sign in to comment.