@@ -4020,15 +4020,14 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end,
40204020 start = min_semi_end - reg -> anchor_dmax ;
40214021 if (start < end )
40224022 start = onigenc_get_right_adjust_char_head (reg -> enc , str , start , end );
4023- else { /* match with empty at end */
4024- start = onigenc_get_prev_char_head (reg -> enc , str , end , end );
4025- }
40264023 }
40274024 if ((OnigDistance )(max_semi_end - (range - 1 )) < reg -> anchor_dmin ) {
40284025 range = max_semi_end - reg -> anchor_dmin + 1 ;
40294026 }
40304027
4031- if (start >= range ) goto mismatch_no_msa ;
4028+ if (start > range ) goto mismatch_no_msa ;
4029+ /* If start == range, match with empty at end.
4030+ Backward search is used. */
40324031 }
40334032 else {
40344033 if ((OnigDistance )(min_semi_end - range ) > reg -> anchor_dmax ) {
@@ -4258,7 +4257,7 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end,
42584257 ONIG_STATE_DEC_THREAD (reg );
42594258
42604259 /* If result is mismatch and no FIND_NOT_EMPTY option,
4261- then the region is not setted in match_at(). */
4260+ then the region is not set in match_at(). */
42624261 if (IS_FIND_NOT_EMPTY (reg -> options ) && region
42634262#ifdef USE_POSIX_API_REGION_OPTION
42644263 && !IS_POSIX_REGION (option )
0 commit comments