I'm trying to write a regular expression statement to remove all spaces except for one space that follows one of two strings:
$str1="abc def ghi klmn op qrs tuv";
$str2=func($str1);
where $str2 should be equal to:
"abc def ghiklmnopqrstuv";
func is a function defined like:
function func($i)
{
$j=ereg_replace("[ \t]","",$i);
return $j;
}
This will just remove all spaces (and tabs).
How do I use one ereg_replace statement to remove all double spaces, and all single spaces that don't follow one of two given string patters?
Any ideas?
TIA-
--Mike
http://sporum.org/