summaryrefslogtreecommitdiffstats
path: root/regex.c
diff options
context:
space:
mode:
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/regex.c b/regex.c
index 06e19cd2..67f17f60 100644
--- a/regex.c
+++ b/regex.c
@@ -1854,6 +1854,26 @@ val match_regex(val str, val reg, val pos)
return nil;
}
+val match_regex_right(val str, val regex, val pos)
+{
+ val slen = length(str);
+
+ if (!pos)
+ pos = zero;
+
+ for (;;) {
+ cons_bind (from, len, search_regex(str, regex, pos, nil));
+
+ if (!from)
+ return nil;
+
+ if (eql(plus(from, len), slen))
+ return len;
+
+ pos = plus(pos, one);
+ }
+}
+
val regsub(val regex, val repl, val str)
{
list_collect_decl (out, ptail);