preg replace - remove if is not in front one of this character !?:;% -
i remove if not in front 1 of character !?:;% preg_replace ( supose ) .
<div> hello ! 100 % clear ? </div> it should give me
<div>hello ! 100 % clear ?</div> thanks in advance
use negative lookahead:
$str = preg_replace('/ (?![!?:;%])/', '', $str);
Comments
Post a Comment