3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = <<<'TEXT' 1. Qatar 2. Qatar 3 . Cathay 4. Qatar 2 . British 3. Qantas TEXT; $output = preg_replace('/(\d+)([.\s]*)/m','$1 . ',$input); echo $output;

preferences:
129.68 ms | 404 KiB | 5 Q