Zend certified PHP/Magento developer

Regex (lookbehind?)

I need to turn this:

zz  zz zz   zzzzYzzzzXzzzz zz     zzzzzz                zzzz zzYzz

into this:

1Y1X1Y1

Preferably in one fell swoop.

Pair is the minimum unit of z.

zz is separated from each other by any number and combination of white spaces (tabs, spaces).

X and Y can be any strings except z and white spaces.

White spaces are always bordered by zz (and are inside Y and X strings).

It would be best if this would be in VBA-compatible syntax.