tregex: no new line in \1 of "(.*)$" when NOTEOL - neatvi - [fork] simple vi-type editor with UTF-8 support
git clone git://src.adamsgaard.dk/neatvi
Log
Files
Refs
README
---
commit 89738c4b7ea3a3d705c408090a85c14610158251
parent a7f36bdd3399c064e74f712a09f66ae464b4c192
Author: Ali Gholami Rudi 
Date:   Fri,  3 Feb 2017 11:46:12 +0330

regex: no new line in \1 of "(.*)$" when NOTEOL

Diffstat:
  M regex.c                             |       4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/regex.c b/regex.c
t@@ -278,14 +278,14 @@ static int ratom_match(struct ratom *ra, struct rstate *rs)
                 return 0;
         }
         if (ra->ra == RA_ANY) {
-                if (!rs->s[0])
+                if (!rs->s[0] || (rs->s[0] == '\n' && !(rs->flg & REG_NOTEOL)))
                         return 1;
                 rs->s += uc_len(rs->s);
                 return 0;
         }
         if (ra->ra == RA_BRK) {
                 int c = uc_dec(rs->s);
-                if (!c)
+                if (!c || (c == '\n' && !(rs->flg & REG_NOTEOL)))
                         return 1;
                 rs->s += uc_len(rs->s);
                 return brk_match(ra->s + 1, c, rs->flg);