[pcre-dev] [Bug 587] Matching null characters

Etusivu
Poista viesti
Lähettäjä: Philip Hazel
Päiväys:  
Vastaanottaja: pcre-dev
Aihe: [pcre-dev] [Bug 587] Matching null characters
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=587




--- Comment #1 from Philip Hazel <ph10@???> 2007-08-24 16:37:34 ---
On Fri, 24 Aug 2007, Joy wrote:

> I'm trying to use regular expressions to match binary strings in addition to
> ASCII strings.
>
> This seems to work great until except, of course, in the case of the hex 0.
> \x00
>
> For example, trying to compile the regex "[\x00-\x20]" produces an error
> because stops after the first bracket.


It works fine for me:

$ ./pcretest
PCRE version 7.3-RC8 2007-08-20

re> /[\x00-\x20]/
data> abc\x00def

0: \x00
data>


OK, that's the next release, but nothing has changed in that area.
Here's a previous release:

$ pcretest
PCRE version 6.6 06-Feb-2006

re> /[\x00-\x20]/
data> abc\x00def

0: \x00
data>


> Since there was a length set for the subject of pcre_exec function, I had hoped
> that all of the buffers were referenced by length and not nessessarily by a
> null terminator.


For pcre_exec(), they are.

> Is there a way to make the compile function use length rather that null
> terminator?


No.

> Any suggestions on the best way to accomplish this?


Use the escape sequence in the data for pcre_compile().


Philip


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email