--- On Tue, 12/29/09, Sam Steingold <> wrote:

From: Sam Steingold <>
Subject: Re: regexp failed to proceed string containing (code-char 0)
To: "Angel Popov" <>
Date: Tuesday, December 29, 2009, 5:03 PM

Angel Popov wrote:
> It looks regexp module fail when string to be proceed contains a char with code 0.
> for example
>  (print (regexp:match "a" (format nil "~casdf" (code-char 0))))
> returns nil
> expected:
> to return #S(REGEXP:MATCH :START 1 :END 2)

the regexp module calls out to the C regexp library, i.e., functions

       int regcomp(regex_t *preg, const char *regex, int cflags);
       int regexec(const  regex_t  *preg,  const  char *string, size_t nmatch,
                   regmatch_t pmatch[], int eflags);

these functions expect 0-terminated strings and cannot handle nuls inside.
I don't think there is a way out here.
if you absolutely do need to match strings containing nuls, you will have to use the cl-pcre module which is pure lisp and thus does not suffer from this limitation.