ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
WildcardMatch.php
Go to the documentation of this file.
1
<?
php
2
3
namespace
PhpOffice\PhpSpreadsheet\Calculation\Internal
;
4
5
class
WildcardMatch
6
{
7
private
const
SEARCH_SET
= [
8
'/(?<!~)\*/ui'
,
9
'/~\*/ui'
,
10
'/(?<!~)\?/ui'
,
11
'/~\?/ui'
,
12
];
13
14
private
const
REPLACEMENT_SET
= [
15
'${1}.*'
,
16
'\*'
,
17
'${1}.'
,
18
'\?'
,
19
];
20
21
public
static
function
wildcard
(
string
$wildcard): string
22
{
23
// Preg Escape the wildcard, but protecting the Excel * and ? search characters
24
$wildcard = str_replace([
'*'
,
'?'
], [0x1A, 0x1B], $wildcard);
25
$wildcard = preg_quote($wildcard);
26
$wildcard = str_replace([0x1A, 0x1B], [
'*'
,
'?'
], $wildcard);
27
28
return
preg_replace(self::SEARCH_SET, self::REPLACEMENT_SET, $wildcard);
29
}
30
31
public
static
function
compare
($value,
string
$wildcard): bool
32
{
33
if
($value ===
''
) {
34
return
true
;
35
}
36
37
return
(
bool
) preg_match(
"/^{$wildcard}\$/mui"
, $value);
38
}
39
}
PhpOffice\PhpSpreadsheet\Calculation\Internal\WildcardMatch\SEARCH_SET
const SEARCH_SET
Definition:
WildcardMatch.php:7
PhpOffice\PhpSpreadsheet\Calculation\Internal\WildcardMatch
Definition:
WildcardMatch.php:5
PhpOffice\PhpSpreadsheet\Calculation\Internal\WildcardMatch\REPLACEMENT_SET
const REPLACEMENT_SET
Definition:
WildcardMatch.php:14
PhpOffice\PhpSpreadsheet\Calculation\Internal
Definition:
MakeMatrix.php:3
PhpOffice\PhpSpreadsheet\Calculation\Internal\WildcardMatch\wildcard
static wildcard(string $wildcard)
Definition:
WildcardMatch.php:21
php
PhpOffice\PhpSpreadsheet\Calculation\Internal\WildcardMatch\compare
static compare($value, string $wildcard)
Definition:
WildcardMatch.php:31
libs
composer
vendor
phpoffice
phpspreadsheet
src
PhpSpreadsheet
Calculation
Internal
WildcardMatch.php
Generated on Thu Jan 30 2025 19:01:22 for ILIAS by
1.8.13 (using
Doxyfile
)