search: match a beginning-of-line anchor just once per line
This fixes https://savannah.gnu.org/bugs/?48635.master
parent
68cfb08888
commit
c88fae3310
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue