protected function replacePattern($string, $pattern, $replacement)
	{
		$replaced = preg_replace($pattern, $replacement, $string);
		return is_null($replaced) ? $string : $replaced;
	}
protected function replacePattern($string, $pattern, $replacement)
	{
		$replaced = preg_replace($pattern, $replacement, $string);
		return is_null($replaced) ? $string : $replaced;
	}
protected function replacePattern ( $ string , $ pattern , $ replacement ) { $ replaced = preg_replace ( $ pattern , $ replacement , $ string ) ; return is_null ( $ replaced ) ? $ string : $ replaced ; }
Replaces all matches of the given regular expression pattern in the
given string with the given replacement. If an error occurs, returns the
original string.

// TODO: Make `replacePattern` multi-byte safe

@param string $string
@param string $pattern
@param string $replacement

@return string
Replaces all matches of the given regular expression pattern in the given string with the given replacement . If an error occurs returns the original string .