[plt-scheme] Re: plt-scheme Digest, Vol 11, Issue 38

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Mon Jul 17 10:55:45 EDT 2006

> (define S
> "\\x0A1,76.23,179000\\x0A2,76.12,53000\\x0A3,76.10,107500\\")
> (pregexp-split "\\" S)  since the \\ is an escape char
> it won't split and I'm having trouble finding the
> proper sequence of chars...

Hi Geb,

The pregexp engine needs to see two literal backslashes.  So in the split 
above, we need to double up each backslash, since the backslashes in the 
string literal "\\" need to be protected:

> (pregexp-split "\\\\" S)
("" "x0A1,76.23,179000" "x0A2,76.12,53000" "x0A3,76.10,107500")

Best of wishes!

Posted on the users mailing list.