How would I go about telling
/z to wrap it up and accept the end of string as end of match? There are really two things you are asking of the engine: to continue where it left off last time, and to fail without forgetting where it's at when it hits the end of string. You need a way to be able to ask for the first without the latter. Otherwise, as a silly example (but let's pretend it isn't),
/.+/z would always fail, even at the end of my input stream where I'd want it to successfully match at end of string.
Makeshifts last the longest.