add getOffsetBeforeMatch method