in reply to UK postcode regex

It sounds like you have three transformations which translate from your excellent specifications to three steps, plus one for validation.

I'm serious about the specs - those are probably the best written specs I've ever seen in a Perlmonks question.