Regex - Remove single whitespace
问题 I´ve got a string that looks like this: "T E S T R E N T A L A K T I E B O L A G" And I want it to look like this: "TEST RENTAL AKTIEBOLAG" But I can´t seem to find the right regex expression for my problem. I would like to remove one single whitespace between each character. Kind Regards / H 回答1: You can use the regex: \s(\s)? And replace with $1 . regex101 demo 回答2: An alternative solution to @Jerry's answer: preg_replace('# (?! )#','',$text) regex101 demo 3v4l.org demo 回答3: you couldnt use