diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-09-21 21:14:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-09-21 21:14:13 -0700 |
commit | cbe8ab16302c0224c2e90dc0dd28e64e80b3fe2b (patch) | |
tree | c23e5679559579ffd2f6dbd30983a45e17e9c80a /txr.1 | |
parent | 9f039218345989a770322611704c3d7ff9a76a12 (diff) | |
download | txr-cbe8ab16302c0224c2e90dc0dd28e64e80b3fe2b.tar.gz txr-cbe8ab16302c0224c2e90dc0dd28e64e80b3fe2b.tar.bz2 txr-cbe8ab16302c0224c2e90dc0dd28e64e80b3fe2b.zip |
Support negative positions in regex matching funs.
* regex.c (match_regex, match_regex_right): Detect
a negative start or end position, respectively,
and add the string length to it. If it is still
negative, bail with nil.
* txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -31748,9 +31748,18 @@ matches at .meta position in .metn string . + If .meta position -is not specified, it is taken to be zero. +is not specified, it is taken to be zero. Negative values +of +.meta position +index from the right end of the string such that -1 +refers to the last character. Excessively negative +values which index before the first character cause +.code nil +to be returned. + If the regex matches, then the length of the match is returned. If it does not match, then .code nil @@ -31778,10 +31787,20 @@ function tests whether contains a match which ends precisely on the character just before .metn end-position . + If .meta end-position is not specified, it defaults to the length of the string, and the function performs a right-anchored regex match. +The +.meta end-position +argument can be a negative integer, in which case it denotes +positions from the end of the string, such that -1 refers +to the last character. If the value is excessively negative such +that the position immediately before it is before the start +of the string, then +.code nil +is returned. If a match is found, then the length of the match is returned. |