Using preg_replace
With 1 :
123def abcdef abcdef
With nothing, no count given :
123def 123def 123def