From ec6464ed8b79e669b4d591f128757404a7e6d0bc Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 25 Sep 2016 23:29:06 -0700 Subject: doc: regex examples. * txr.1: Examples for f^$, f^ and f$. --- txr.1 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index b6499744..87841e16 100644 --- a/txr.1 +++ b/txr.1 @@ -32544,6 +32544,27 @@ and between and .codn m$ . +.TP* Examples: + +.cblk + ;; produce list which contains only strings + ;; beginning with "cat": + (keep-if (f^ #/cat/) '#"dog catalog cat fox catapult") + --> ("catalog" "cat" "catapult") + + ;; map all strings in a list to just their trailing + ;; digits. + (mapcar (f$ #/\ed*/) '#"a123 4 z bc465") + --> ("123" "4" "" "465") + + ;; check that all strings consist of digits after + ;; the third position. + (all '#"ABC123 DFE45 12379" (f^$ #/\ed*/ 3)) + --> "79" ; i.e. true + (all '#"ABC123 DFE45 12379A" (f^$ #/\ed*/ 3)) + --> nil +.cble + .SS* Hashing Library .coNP Functions @ make-hash and @ hash .synb -- cgit v1.2.3