I'm messing about with the LESS PHP parser to get it to replace 4 colour hex codes found in IE filters. What I want to do is replace stuff like this: #ff7755 33 with #ff775533 ie. remove all the spaces in it. Obviously the characters can vary as they're colour codes. I found this question which is very close to what I want.
Right now, I have this regex which finds the string just fine:
(#([0-9a-f]){6}\s[0-9a-f]{2})
All I need now is the regex to put in the replace argument of preg_replace().
return, not just the found/replaced bit. Or did I misunderstand you here?$str = preg_replace("/ /", "", $str);if you already know it's definitely a valid color code.