diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-04-10 03:11:09 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-04-10 03:11:09 -0700 |
commit | d228557c3c400ba7a81ba0b0fd867ec78bb35015 (patch) | |
tree | 0a5aaca7ead1d53d89a30fab76b2263838cd2f98 /txr.1 | |
parent | d26540493a85fe2f4e85da81504cc0264df0c11f (diff) | |
download | txr-d228557c3c400ba7a81ba0b0fd867ec78bb35015.tar.gz txr-d228557c3c400ba7a81ba0b0fd867ec78bb35015.tar.bz2 txr-d228557c3c400ba7a81ba0b0fd867ec78bb35015.zip |
* eval.c (eval_init): Expose regex-compile and regexp as intrinsics.
* lib.c (obj_init): Change spelling of nongreedy operator and put
it into the user package so that it is available for use with
regex-compile.
* regex.c (match_regex, search_regex): Bugfix: optional start
position argument argument not defaulting to zero.
* txr.1: Documented regex-compile and regexp.
* txr.vim: Highlighting regex-compile and regexp.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -7274,6 +7274,46 @@ Examples: ;; Replace Hello with Goodbye: (regsub #/Hello/ "Goodbye" "Hello world!") -> "Goodbye world!" +.SS Function regexp + +.TP +Syntax: + + (regexp <obj>) + +.TP +Description: + +The regexp function returns t if <obj> is a compiled regular expression +object. For any other object type, it returns nil. + +.SS Function regex-compile + +.TP +Syntax: + + (regex-compile <form>) + +.TP +Description: + +The regex compile function takes the source code of a regular expression, +expressed as a Lisp data structure, and compiles it to a regular expression +object. + +.TP +Examples: + + ;; the equivalent of #/[a-zA-Z0-9_/ + (regex-compile '(set (#\ea . #\ez) (#\eA . #\eZ) (#\e0 . #\e9) #\e_)) + + ;; the equivalent of #/.*/ and #/.+/ + (regex-compile '(0+ wild)) + (regex-compile '(1+ wild)) + + ;; #/a|b|c/ + (regex-compile '(or (or #\ea #\eb) #\ec)) + .SS Functions make-hash, hash .SS Function sethash |