From: Edi Weitz

Subject: Re: regexp confusion

Date: 2003-12-7 21:11

On Sun, 07 Dec 2003 19:47:59 -0500, Jack Tanner <hotmail.com at ihok> wrote:

> I can't tell if this is a bug or not. I'm using ACL 6.2 with all > recent patches applied. > > CL-USER(19): (match-regexp "^[0-9 ,]*$" "4, 7") > T > "4, 7" > CL-USER(21): (match-regexp "^[0-9\\b,]*$" "4, 7") > NIL > > The only difference is that in the regexp, I substitute a space for > \\b, and all of a sudden the string matches. Isn't \\b supposed to > be a catch-all for all kinds of whitespace?
CL-USER(10): (compile-regexp "[0-9 ,]") #(EXCL::REGULAR-EXPRESSION "[0-9 ,]" 1 ((:GROUP-START 0) (:OR #*0000000000000000000000000000000010000000000010001111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (:GROUP-END 0)) 0) CL-USER(11): (compile-regexp "[0-9\\b,]") #(EXCL::REGULAR-EXPRESSION "[0-9\\b,]" 1 ((:GROUP-START 0) (:OR #*0000000000000000000000000000000000000000000010001111111111000000000000000000000000000000000010000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (:GROUP-END 0)) 0) This looks like the first [...] consists of #\Space, the comma, and the ten digits, while the second [...] doesn't have the #\Space but #\b and backslash instead. Which seems to imply that \\b isn't special in [...] character classes. Shameless plug: Use CL-PPCRE[1] instead... :) CL-USER(21): (cl-ppcre:scan-to-strings "^[0-9 ,]*$" "4, 7") "4, 7" #() CL-USER(22): (cl-ppcre:scan-to-strings "^[0-9\\s,]*$" "4, 7") "4, 7" #() Cheers, Edi. [1] <http://weitz.de/cl-ppcre/>