search: match a beginning-of-line anchor just once per line

This fixes https://savannah.gnu.org/bugs/?48635.
master
Benno Schulenberg 2016-07-27 09:04:06 +02:00
parent 68cfb08888
commit c88fae3310
1 changed files with 2 additions and 2 deletions

View File

@ -745,8 +745,8 @@ ssize_t do_replace_loop(
} }
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
/* Don't find the same zero-length match again. */ /* Don't find the same zero-length or BOL match again. */
if (match_len == 0) if (match_len == 0 || (*needle == '^' && ISSET(USE_REGEXP)))
match_len++; match_len++;
#endif #endif