in reply to Re^2: Integrating match counts into regex matching
in thread Integrating match counts into regex matching

That is correct. The \z means end of string. It keeps you from matching things like "ben".

But I misread your problem. I will match things like "bab" which is not according to your spec.

  • Comment on Re^3: Integrating match counts into regex matching