commit da7f7882a2797fa3b6fbc9886e8a2144625739bb from: rsc date: Fri May 18 16:43:43 2007 UTC Match leading ^ in regexp with embedded newlines (Roger Peppe) commit - d91ab9ea7b4c0587b4ac5bcbddf091a269bd9213 commit + da7f7882a2797fa3b6fbc9886e8a2144625739bb blob - 62ab1a31e692745183218ee7538bc0f6c5384d10 blob + a00fbcbc9b8cbee2ce787863edcce9c14ebea349 --- src/libregexp/regexec.c +++ src/libregexp/regexec.c @@ -58,7 +58,7 @@ regexec1(Reprog *progp, /* program to run */ p = utfrune(s, '\n'); if(p == 0 || s == j->eol) return match; - s = p; + s = p+1; break; } } blob - eece0eb9d8adfaa74c708bc42661b4e5074efc6a blob + 4312c4f9515c30c0590ff6c8bca1ccb3cedcafaf --- src/libregexp/rregexec.c +++ src/libregexp/rregexec.c @@ -25,6 +25,7 @@ rregexec1(Reprog *progp, /* program to run */ Relist* tle; /* ends of this and next list */ Relist* nle; int match; + Rune *p; match = 0; checkstart = j->startchar; @@ -44,20 +45,18 @@ rregexec1(Reprog *progp, /* program to run */ if(checkstart) { switch(j->starttype) { case RUNE: - while(*s != j->startchar) { - if(*s == 0 || s == j->reol) - return match; - s++; - } + p = runestrchr(s, j->startchar); + if(p == 0 || p == j->eol) + return match; + s = p; break; case BOL: if(s == bol) break; - while(*s != '\n') { - if(*s == 0 || s == j->reol) - return match; - s++; - } + p = runestrchr(s, '\n'); + if(p == 0 || s == j->reol) + return match; + s = p+1; break; } }