$_ ='the quick "brown fox" jumps over the "lazy dog"'; $in = 0; s[ (?>(.)) (?{ $in = ~ $in if $1 eq '"' }) ([\t ]) ] [ $in ? $1.$2 : $1 ]gex; print thequick"brown fox"jumpsoverthe"lazy dog"