Thanks Enrico, 

I've written the custom function...

ClassMethod PostCodeLastCharacter(PID11 As %String)
{
Set ReturnValue = 0

if ($EXTRACT(PID11,*) = "Z")

{set ReturnValue = 1 }

Quit ReturnValue

}

I've added a trace to my rule which returns the relevant 1 or 0 (depending on the post code). However, my rule condition which references the function doesn't trigger an message...

PostCodeLastCharacter(HL7.{PID:11(1).5}=1)

Have I got the syntax correct?