$string = "a b c"; $string2 = ereg_replace("/\s\s+/", " ", $string);
I am trying to convert the two whitespaces into one, why doesnt the code above work?
Try this (it works for me):
$string = "a b c"; $string2 = ereg_replace("[[:space:]]", "", $string);
Hope that helps!
~ Eric 123 Make Me! ( http://123-makeme.com )
It doesn't work because \s\s+ means "one whitespace followed by one or more whitespaces"
if you change it to \s+ "one or more whitespaces" it should work.
Sorry I had written multiple spaces but suppose the form doesnt paste the posts in <pre> format. Anyway I changed the \s with " " and that worked out like a charm, thanks!
Henrik