public function pregReplace($str, $pattern, $replacement = '', $limit = -1)
{
return preg_replace($pattern, $replacement, $str, $limit);
}
public function testPregReplaceWithReplacementWithLimit() { $app = $this->getApp(); $handler = new TextHandler($app); $result = $handler->pregReplace('One koala, two koalas, three koalas, four!', '#(ko)a(la|las)#', 'clippy', 2); $this->assertSame('One clippy, two clippys, three koalas, four!', $result); }