I need to remove all whitespace from string, but quotations should stay as they were.
Here’s an example:
string to parse:
hola hola "pepsi cola" yay
output:
holahola"pepsi cola"yay
Any idea? I’m sure this can be done with regex, but any solution is okay.
We could match strings or quotations with
So we just need to
preg_match_alland concatenate the result.Example: