Are you sure this is the exact line? Did you copy it or type it? As it stands this does not work for me at all, however, I can tell you what most of it is doing:
This should generate a colour but the format is wrong
Everything in capitals is an environment variable.
'%%.*' says remove everything from hostname after first dot from the front.
'/#$HOME/~' says change the first value for the second if in the variable PWD
\007 in the ascii table says it is a bell so not sure about that one.