I am trying to filter out words smaller than 3 chars from a string as following:
$s = "fleece plaid rood fleece deken fleece plaid v z v borduring 220 g ma fleece";
$redundant = "/\s[^\s]{1,2}\s/";
$s = preg_replace($redundant, " ", " " . $s . " ");
First run would return:
"fleece plaid rood fleece deken fleece plaid z borduring 220 ma fleece "
And if I run it with that string again it returns:
"fleece plaid rood fleece deken fleece plaid borduring 220 fleece "
But of course I want to only run the preg_replace only once. Anyone a bright idea
what I am doing wrong here?
PS. Also tried:\s.{1,2}\s but that is giving the same result.