2016-06-25 5 views

답변

1

preg_split, preg_grepimplode 함수를 사용하여 시도 , 이렇게 :

$string = "Test let's test 123. https://youtu.be/dQw4w9WgXcQ EOTest."; 
$words = preg_split('/\s+/', $string); // split on one or more spaces 
$filter = preg_grep('/^[A-Za-z\d.]+$/', $words); // allow dot, letters, and numbers 
$result = implode(' ', $filter); // turn it into a string 
print_r($result); // -> Test test 123. EOTest. 

도움이 되었기를 바랍니다.

관련 문제