public function testReplace() { $builder = new \Gherkins\RegExpBuilderPHP\RegExpBuilder(); $regExp = $builder->min(1)->max(10)->digits()->getRegExp(); $text = "98 bottles of beer on the wall"; $text = $regExp->replace($text, function ($match) { return (int) $match + 1; }); $this->assertTrue("99 bottles of beer on the wall" === $text); }