php验证POST中的空格

my question is this: I made a very simple adress book. The information is showing in html table and i just want to make as simple as possible function to delete an item from the book. I just want to copy the line with the information of the item and paste in the text input to delete it, butt I have problem with the too long white spaces in the string. String looks like '21-07-2015........ Coffe .......1.5...... Food', (the dots are showing how much space is between the words) but i just need one space between the words. Is there any way to do that without giving a deam how long is the white space between them. 'Trim is not helping here, just in case.'

if($_POST) {
$DELETE = $_POST['remove_line'];
$DELETE = str_replace('     ',' ',$DELETE);
$DELETE = str_replace(' ','!',$DELETE);
echo '<pre>'.print_r($DELETE,true).'</pre>';
$data = file("./info.txt");
$out = array();

foreach ($data as $line) {
    if (trim($line) != $DELETE) {
        $out[] = $line;
    }
}

$fop = fopen("./info.txt", "w+");
flock($fop, LOCK_EX);
foreach ($out as $line) {
    if($line) {
        if(fwrite($fop, $line)){
            $itemRemoved = 'Item has been removed correctly.';
        } else{
            $itemRemoved = 'You entered info item wrong.';
        };

    }
}
flock($fop, LOCK_UN);
fclose($fop);
}

You can replace two or more spaces with just one space by performing the following regular expression:

$string = preg_replace('/\s+/', ' ', $string);

try this

$DELETE = preg_replace('\s+', ' ', $_POST['remove_line']);