• Модуль: subscribe
  • Путь к файлу: ~/bitrix/modules/subscribe/classes/general/posting.php
  • Класс: CPostingGeneral
  • Вызов: CPostingGeneral::SplitFileName
static function SplitFileName($file_name)
{
	$found = array();
	// exapmle(2).txt
	if(preg_match("/^(.*)\((\d+?)\)(\..+?)$/", $file_name, $found))
	{
		$fname = $found[1];
		$fext = $found[3];
		$index = $found[2];
	}
	// example(2)
	elseif(preg_match("/^(.*)\((\d+?)\)$/", $file_name, $found))
	{
		$fname = $found[1];
		$fext = "";
		$index = $found[2];
	}
	// example.txt
	elseif(preg_match("/^(.*)(\..+?)$/", $file_name, $found))
	{
		$fname = $found[1];
		$fext = $found[2];
		$index = 0;
	}
	// example
	else
	{
		$fname = $file_name;
		$fext = "";
		$index = 0;
	}
	return array($fname, $fext, $index);
}