diff --git a/Modules/regexpr.c b/Modules/regexpr.c index 90bff874ab4..87f747fc3eb 100644 --- a/Modules/regexpr.c +++ b/Modules/regexpr.c @@ -1914,7 +1914,7 @@ int re_search(regexp_t bufp, } if (anchor == 1) { /* anchored to begline */ - if (pos > 0 && string[pos - 1]) + if (pos > 0 && (string[pos - 1] != '\n')) continue; } assert(pos >= 0 && pos <= size);