summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Woelders <kim@woelders.dk>2021-11-13 07:29:53 +0100
committerKim Woelders <kim@woelders.dk>2021-11-13 18:07:07 +0100
commit370a899bec838291da4707b65527678ad753cde6 (patch)
treed21e27b6bda489a143eb4a89fc76847f77bc91e8
parent44b31fbbd123546ede1ff2524b23f6b642014e2c (diff)
Regular expression matching fix simplification
-rw-r--r--src/regex.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/regex.c b/src/regex.c
index 3504f8dd..4e377e5a 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -89,7 +89,7 @@ matchregexp(const char *rx, const char *s)
89 } 89 }
90 if ((!rx[l]) && (s[lenr])) 90 if ((!rx[l]) && (s[lenr]))
91 return 0; 91 return 0;
92 for (i = lenr; i < len; i++) 92 for (i = lenr; i < len;)
93 { 93 {
94 if (rx[l]) 94 if (rx[l])
95 l++; 95 l++;
@@ -102,15 +102,6 @@ matchregexp(const char *rx, const char *s)
102 i = isafter(i, s, rx2); 102 i = isafter(i, s, rx2);
103 if (i < 0) 103 if (i < 0)
104 return 0; 104 return 0;
105 // Because the for loop will increment i (the index
106 // into string s) at the end of this block, but i now
107 // already points to the next char in s, this next char
108 // gets ignored.
109 // Without this next decrement, if the regex is *bla,
110 // it will incorrectly say that blax matches, although
111 // correctly say that blaxy doesn't. Ie. char x is skipped
112 if (i > 0)
113 i--;
114 } 105 }
115 else 106 else
116 { 107 {