tregex: match "^" and "$" after and before new line characters - neatvi - [fork… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 234b9325f5437b813bad047f5bead5ec64335c87 | |
parent f614d398653cac4aad4dbc17d730145b11c33167 | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Fri, 14 Aug 2015 10:41:25 +0430 | |
regex: match "^" and "$" after and before new line characters | |
Diffstat: | |
M regex.c | 4 ++-- | |
1 file changed, 2 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/regex.c b/regex.c | |
t@@ -291,9 +291,9 @@ static int ratom_match(struct ratom *ra, struct rstate *rs) | |
return brk_match(ra->s + 1, c, rs->flg); | |
} | |
if (ra->ra == RA_BEG && !(rs->flg & REG_NOTBOL)) | |
- return rs->s != rs->o; | |
+ return !(rs->s == rs->o || rs->s[-1] == '\n'); | |
if (ra->ra == RA_END && !(rs->flg & REG_NOTEOL)) | |
- return rs->s[0] != '\0'; | |
+ return rs->s[0] != '\0' && rs->s[0] != '\n'; | |
if (ra->ra == RA_WBEG) | |
return !((rs->s == rs->o || !isword(uc_beg(rs->o, rs->s - 1)))… | |
isword(rs->s)); |