How about using Y.Lang.sub and Y.Escape?