I want to replace whitespaces with another string using PHP.
I do it as follows:
$string = 'whatever text including some $text between delimiters$ and...';
$string_replaced = preg_replace('/\s\s+/', '\:', $string);
But it replaces all the spaces in the string, which is very logic.
I only want the regex to apply between the $ delimiters.
In the official preg_replace() docs, I do not find anything that might help.
So I guess I am missing some PHP feature that will allow this.