summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-03 07:05:39 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-03 07:05:39 -0700
commit4c9640f9a5d35164bbede6a7e6240611215a04f2 (patch)
tree87a303d82e29290da1230ac5744673d2bb70aec9 /txr.1
parent4fbc51dadaeb3d25887cec5bf824b8992a960b02 (diff)
downloadtxr-4c9640f9a5d35164bbede6a7e6240611215a04f2.tar.gz
txr-4c9640f9a5d35164bbede6a7e6240611215a04f2.tar.bz2
txr-4c9640f9a5d35164bbede6a7e6240611215a04f2.zip
New rr function.
* regex.c (regex_range_search): New function. (regex_init): Register regex_range_search as rr intrinsic. * regex.h (regex_range_search): Declared. * txr.1: Documented rr, and added reference to it in description of regex-range.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.154
1 files changed, 49 insertions, 5 deletions
diff --git a/txr.1 b/txr.1
index ba023aa2..108dc600 100644
--- a/txr.1
+++ b/txr.1
@@ -32236,6 +32236,12 @@ indicates the position one element past the
last character of the match. If the match is empty, the two integers
are equal.
+Also see the
+.code rr
+function, which provides an alternative argument syntax for
+the semantics of
+.codn range-regex .
+
The
.code search-regst
differs from
@@ -32698,7 +32704,6 @@ results in a failed match and consequently
.code nil
being returned.
-
The
.code m^$
function tests whether the entire portion of
@@ -32739,14 +32744,15 @@ Otherwise
.code nil
is returned.
-.coNP Functions @, r^$ @ r^ and @ r$
+.coNP Functions @, r^$ @, r^ @ r$ and @ rr
.synb
.mets (r^$ < regex <> [ position ] << string )
.mets (r^ < regex <> [ position ] << string )
.mets (r$ < regex <> [ end-position ] << string )
+.mets (rr < regex >> [ position <> [ from-end ]] << string )
.syne
.desc
-These functions perform the same operations as,
+The first three of these functions perform the same operations as,
respectively,
.codn m^$ ,
.code m^
@@ -32760,6 +32766,13 @@ the matching substring within
rather than the matching substring itself.
The
+.code rr
+function performs the same operation as
+.code range-regex
+with different conventions with regard to argument
+order, harmonizing with those of the other three functions above.
+
+The
.meta position
argument, if omitted,
defaults to zero, so that the
@@ -32777,7 +32790,7 @@ string.
With one exception, a value in either parameter which is excessively negative
or positive, such that it indexes before the start of the string or exceeds its
length results in a failed match and consequently
-.codn nil
+.code nil
being returned. The exception is that the
.code rr
function permits a negative
@@ -32816,7 +32829,7 @@ Otherwise
is returned.
The
-.code m$
+.code r$
function tests whether the portion of
.meta string
ending just before
@@ -32828,6 +32841,37 @@ Otherwise
.code nil
is returned.
+The
+.code rr
+function searches
+.meta string
+starting at
+.meta position
+for a matches for
+.codn regex .
+If
+.meta from-end
+is specified and true, the rightmost
+match is reported.
+If a match is found, it is reported
+as a range.
+
+A regular expression which matches empty
+strings matches at the start position,
+and every other position, including
+the position just after the last
+character, coinciding with the length of
+.metn string .
+
+Except for the different argument order such that
+.meta string
+is always the rightmost argument, the
+.code rr
+function is equivalent to the
+.code range-regex
+function, such that correspondingly named
+arguments have the same semantics.
+
.coNP Functions @, f^$ @ f^ and @ f$
.synb
.mets (f^$ < regex <> [ position ])