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;
	}
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;
	}
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 ; }
Replace Unicode properties in a string

NOTE: does not support \X

@link http://docs.php.net/manual/en/regexp.reference.unicode.php

@param  string $str              Original string
@param  bool   $inCharacterClass Whether this string is in a character class
@param  bool   $dotAll           Whether PCRE_DOTALL is set
@return string                   Modified string
Replace Unicode properties in a string