<?php $strings = [ "I-IVWM_Ask-21_(max_2h)", "D-7849_DG303_(max_4h)", "Aliante_Privato" ]; foreach ($strings as $str) { $pattern = "/^[^\s()]+(?:\([^()]*\))?$/"; echo preg_replace_callback($pattern, function ($x) { return trim(preg_replace("/[()_]+/", " ", $x[0])); }, $str) . PHP_EOL; }
You have javascript disabled. You will not be able to edit any code.