1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
regexfield.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Main\PhoneNumber\Tools;
4
5
use Bitrix\Main\SystemException;
6
7
class
RegexField
extends
XmlField
8
{
9
public
function
decodeValue
($value)
10
{
11
return
static::validateRegex($value,
true
);
12
}
13
14
public
static
function
validateRegex
($regex, $removeWhitespace =
false
)
15
{
16
$compressedRegex = $removeWhitespace ? preg_replace(
'/\\s/'
,
''
, $regex) : $regex;
17
18
// Match regex against an empty string to check the regex is valid
19
if
(preg_match(
'/'
.$compressedRegex.
'/'
,
''
) ===
false
)
20
{
21
throw
new
SystemException
(
"Regex error: "
.preg_last_error());
22
}
23
24
return
$compressedRegex;
25
}
26
27
}
Bitrix\Main\PhoneNumber\Tools\RegexField
Определения
regexfield.php:8
Bitrix\Main\PhoneNumber\Tools\RegexField\validateRegex
static validateRegex($regex, $removeWhitespace=false)
Определения
regexfield.php:14
Bitrix\Main\PhoneNumber\Tools\RegexField\decodeValue
decodeValue($value)
Определения
regexfield.php:9
Bitrix\Main\PhoneNumber\Tools\XmlField
Определения
xmlfield.php:6
Bitrix\Main\SystemException
Определения
SystemException.php:9
bitrix
modules
main
lib
phonenumber
tools
regexfield.php
Создано системой
1.14.0