[racket] Regexp character classes

From: Mark Carter (mcturra2000 at yahoo.co.uk)
Date: Sat Aug 27 03:58:29 EDT 2011

I'm trying to do a regexp split, but I can't get it to work. Here's my code:

(require mzlib/pregexp)

(define str "17.4     25.4     15.7     13.7     19.4     20.9     ")
(pregexp-split #rx"[:space:]+" str)


The output is 

'("17.4 \t25.4 \t15.7 \t13.7 \t19.4 \t20.9 \t")

which is of course not what I expected. I wanted the numbers split out. Any ideas as to how to use the [:space:] class correctly, as the docs don't give examples.




Posted on the users mailing list.