-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96efe3d
commit 6b96083
Showing
4 changed files
with
29 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Inspector\Symfony\Bundle; | ||
|
||
class Filters | ||
{ | ||
public static function matchWithWildcard(string $pattern, string $url) | ||
{ | ||
// Escape special regex characters in the pattern, except for '*'. | ||
$escapedPattern = preg_quote($pattern, '/'); | ||
|
||
// Replace '*' in the pattern with '.*' for regex matching. | ||
$regex = '/^' . str_replace('\*', '.*', $escapedPattern) . '$/'; | ||
|
||
// Perform regex match. | ||
return (bool)preg_match($regex, $url); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters