Putting a space between something specific

I would like to know how to automatically put space between signs

The marker would be >> ## << and the spaces would need to be put before it; but not always [and that's the problem]

Examples:

BEFORE
##01##02 ##03  ##04
AFTER
##01 ##02 ##03  ##04


BEFORE
##01##CITY ##03  ##04
AFTER
##01 ##CITY ##03  ##04


BEFORE
##01##02 ##village  ##04
AFTER
##01 ##02 ##village  ##04

So the rule is: put a single space there, where there is any kind of sign followed by two hastags; and thus not putting more spaces where they already are

In other words: two hastags adjacent to something are correct; but two hastags in the middle of smething are wrog and need to be separated from whatever signs there might be before [and not after] them

Can it be done?

I would use a more or less brute force approach:
Simple replace: all ## with space-space-##
Simple replace: all 4-spaces with 2 spaces
Simple replace: all 3-spaces with 2 spaces.
Format value field: $trim(%field%)
(to get rid of leading spaces at the front)

You may do it this way, like 'ohrenkino' in post #2 already pointed out, ...

Before: TEST = '##01##02 ##village ##04' Convert "Tag-Tag" ... or ... Action "Format value" Field: TEST Formatstring: $trim($replace(%TEST%,'##',' ##',' ##',' ##')) Result: TEST = '##01 ##02 ##village ##04'

DD.20150616.2134.CEST

Thank you both very much

[The first suggested way I should have figured out on my own, shame on me]

I use now this code

$replace(%GENRE%,'#','##','###','##')
$trim($replace(%GENRE%,'##',' ##','  ##',' ##'))

And after it I run some more to get rid of unwanted spaces, than might were there before

In this way I get

##00  ##00  ##00  ##abc  ##abc  ##abc

which is the format / visual, that I need