protected static function unfoldUnicodeProperties($str, $inCharacterClass, $dotAll)
	{
		$unicodeProps = self::$unicodeProps;

		$str = preg_replace_callback(
			self::$unicodePropsRegexp,
			function ($m) use ($inCharacterClass, $unicodeProps)
			{
				$propName = preg_replace('#[\\{\\}]#', '', $m[2]);

				if ($propName[1] === '^')
				{
					// Replace p^L with PL
					$propName = (($propName[0] === 'p') ? 'P' : 'p') . substr($propName, 2);
				}

				return (($inCharacterClass) ? '' : '[')
				     . $unicodeProps[$propName]
				     . (($inCharacterClass) ? '' : ']');
			},
			$str
		);

		if ($dotAll)
		{
			$str = preg_replace(
				'#(?<!\\\\)((?:\\\\\\\\)*+)\\.#',
				'$1[\\s\\S]',
				$str
			);
		}

		return $str;
	}