• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/phonenumber/tools/regexfield.php
  • Класс: BitrixMainPhoneNumberToolsRegexField
  • Вызов: RegexField::validateRegex
static function validateRegex($regex, $removeWhitespace = false)
{
	$compressedRegex = $removeWhitespace ? preg_replace('/\s/', '', $regex) : $regex;

	// Match regex against an empty string to check the regex is valid
	if (preg_match('/'.$compressedRegex.'/', '') === false)
	{
		throw new SystemException("Regex error: ".preg_last_error());
	}

	return $compressedRegex;
}