<?php $strings = [ "TeSt", "Te s-t", "", "Te4St" ]; foreach ($strings as $string) { if(preg_match('#^[a-z -]+$#i', $string, $matches)){ echo $matches[0] . PHP_EOL; } }
You have javascript disabled. You will not be able to edit any code.