pregReplace() публичный Метод

Examples:: String.pregReplace("Some.String with sp:cial characters", "/[[:^alnum:]]/", "-") == "Some-String-with-sp-cial-characters" String.pregReplace("2016-08-31", "/([0-9]+)-([0-9]+)-([0-9]+)/", "$3.$2.$1") == "31.08.2016"
public pregReplace ( string $string, string $pattern, string $replace ) : string
$string string The input string
$pattern string A PREG pattern
$replace string A replacement string, can contain references to capture groups with "\\n" or "$n"
Результат string The string with all occurrences replaced
 /**
  * @test
  * @dataProvider pregReplaceExamples
  */
 public function pregReplaceWorks($string, $pattern, $replace, $expected)
 {
     $helper = new StringHelper();
     $result = $helper->pregReplace($string, $pattern, $replace);
     $this->assertSame($expected, $result);
 }