Skip to content

Index of Module pregexp

mgorges edited this page Oct 16, 2014 · 1 revision

Module: pregexp

The pregexp module contains Dorai Sitaram's portable library for regular expressions. Please refer to http://www.ccs.neu.edu/home/dorai/pregexp/ for instructions on use. The functions in the module are listed below with relative links into the pregexp API documention:

Function
pregexp
pregexp‑match‑positions
pregexp‑match
pregexp‑split
pregexp‑replace
pregexp‑replace*
pregexp‑quote

Examples

Example from modules/sanestring/sanestring.scm to check a date following the ISO format

(define (sanestring-dob s)
  (let* ((yyyy "(?x: 19[1-9][0-9] | 20[0-9][0-9] )")
         (mm "(?x: 0[0-9] | 1[0-2] )")
         (dd "(?x: [0-2][0-9] | 3[0-1] )")
         (dob (string-append "^" yyyy "\\-" mm "\\-" dd "$")))
    (pregexp-match dob s)
  ))
Clone this wiki locally