[lang-ref] ( replace_all_with_regexp ) ( php )

<?php
public function testReplaceAllWithRegexp(): void
{
	// preg_replace($pattern, $after, $text)
	$text_org = "abc def ghi\nabc def ghi";
	$pattern = '/d.f/';
	$s_new  = '!!DEF!!';

	$text_new = preg_replace($pattern, $s_new, $text_org);

	$this->assertNotFalse($text_new);
	$this->assertSame("abc !!DEF!! ghi\nabc !!DEF!! ghi", $text_new);
}