<?php $string = "This is a short sentence which should include all regex results"; echo preg_replace_callback( '~(\w{3})?(\w+)~', fn($m) => ($m[1] ? "+" : '') . "$m[0]*", $string );
You have javascript disabled. You will not be able to edit any code.