Match leading ^ in regexp with embedded newlines (Roger Peppe)
This commit is contained in:
parent
d91ab9ea7b
commit
da7f7882a2
2 changed files with 10 additions and 11 deletions
|
|
@ -58,7 +58,7 @@ regexec1(Reprog *progp, /* program to run */
|
||||||
p = utfrune(s, '\n');
|
p = utfrune(s, '\n');
|
||||||
if(p == 0 || s == j->eol)
|
if(p == 0 || s == j->eol)
|
||||||
return match;
|
return match;
|
||||||
s = p;
|
s = p+1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ rregexec1(Reprog *progp, /* program to run */
|
||||||
Relist* tle; /* ends of this and next list */
|
Relist* tle; /* ends of this and next list */
|
||||||
Relist* nle;
|
Relist* nle;
|
||||||
int match;
|
int match;
|
||||||
|
Rune *p;
|
||||||
|
|
||||||
match = 0;
|
match = 0;
|
||||||
checkstart = j->startchar;
|
checkstart = j->startchar;
|
||||||
|
|
@ -44,20 +45,18 @@ rregexec1(Reprog *progp, /* program to run */
|
||||||
if(checkstart) {
|
if(checkstart) {
|
||||||
switch(j->starttype) {
|
switch(j->starttype) {
|
||||||
case RUNE:
|
case RUNE:
|
||||||
while(*s != j->startchar) {
|
p = runestrchr(s, j->startchar);
|
||||||
if(*s == 0 || s == j->reol)
|
if(p == 0 || p == j->eol)
|
||||||
return match;
|
return match;
|
||||||
s++;
|
s = p;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case BOL:
|
case BOL:
|
||||||
if(s == bol)
|
if(s == bol)
|
||||||
break;
|
break;
|
||||||
while(*s != '\n') {
|
p = runestrchr(s, '\n');
|
||||||
if(*s == 0 || s == j->reol)
|
if(p == 0 || s == j->reol)
|
||||||
return match;
|
return match;
|
||||||
s++;
|
s = p+1;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue